bettereyes1 Posted December 5, 2003 Share Posted December 5, 2003 It would be really nice if there were a DirCopy or DirMove command, that would let you copy (or move) an entire directory, plus all of it's files and sub-folders in one easy step. The help file states that the FileMove function can move directories, but I have not been able to get that to work at all. I don't know if it's a bug, or if it's just to painfully obvious for me to see how to do it. Anyone have any ideas how I could do this? Thanks! Link to comment Share on other sites More sharing options...
sykes Posted December 5, 2003 Share Posted December 5, 2003 Sounds like a good idea to me ... how about a DirRename as well? Could come in handy from time to time We have enough youth. How about a fountain of SMART? Link to comment Share on other sites More sharing options...
CyberSlug Posted December 5, 2003 Share Posted December 5, 2003 (edited) The windows dir command might help....Displays a list of files and subdirectories in a directory. DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N] [/O[[:]sortorder]] [/P] [/Q] [/S] [/T[[:]timefield]] [/W] [/X] [/4]Also, see xcopyCopies files and directory trees. XCOPY source [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/V] [/W] [/C] [/I] [/Q] [/F] [/L] [/G] [/H] [/R] [/T] [/U] [/K] [/N] [/O] [/X] [/Y] [/-Y] [/Z] [/EXCLUDE:file1[+file2][+file3]...] Edited December 5, 2003 by CyberSlug Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
bettereyes1 Posted December 9, 2003 Author Share Posted December 9, 2003 I was hoping to be able to do this without calling a DOS command, but you're right, the XCOPY command would work perfectly to copy those files. Possibly even the DOS MOVE command also. Thanks for your suggestion! Link to comment Share on other sites More sharing options...
niranjan8shh Posted December 9, 2003 Share Posted December 9, 2003 ....., the XCOPY command would work perfectly to copy those files.Beware though that xcopy behaves differently in NT4 W2k and XP, in case your script has to work on multiple systems. Of particular significance is /Y which is not understood by NT4, as well as that xcopy on NT4 keeps asking if the file to be copied is a file or a directory if folders do not exist in advance.I found it the hard way. regardsniranjan Link to comment Share on other sites More sharing options...
jpm Posted December 11, 2003 Share Posted December 11, 2003 The dir*** is included in the dbg-bastard stuff under the filemove Just ask Jon to have time to integrate it. Link to comment Share on other sites More sharing options...
Administrators Jon Posted December 11, 2003 Administrators Share Posted December 11, 2003 I'm sure that when I tested the FileMove command it happily moved/renamed entire directories. I'll have to recheck. Edit: Yeah, FileMove works here moving entire directories and any sub directories/files. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
Valik Posted December 11, 2003 Share Posted December 11, 2003 I'm sure that when I tested the FileMove command it happily moved/renamed entire directories. I'll have to recheck.I just tested FileMove on Windows XP SP-1 and it worked fine for both moving and renaming directories. Link to comment Share on other sites More sharing options...
Valik Posted December 11, 2003 Share Posted December 11, 2003 One thing I didn't see anybody mention is that all directories along the path you are moving to have to exist or FileMove won't do anything. For example, given this directory structure: C:\Folder To Move C:\Another Folder FileMove("C:\Folder To Move", "C:\Another Folder\Moved Here") The above works, "Folder To Move" will be moved and renamed. FileMove("C:\Folder To Move", "C:\Another Folder\Sub\Not Moved") This will not work since the directory "Sub" doesn't exist. FileMove returns 1 to indicate failure. Maybe you were trying to do something like the above and that's why FileMove wouldn't work? Link to comment Share on other sites More sharing options...
bettereyes1 Posted January 28, 2004 Author Share Posted January 28, 2004 Hey, thanks for all the help. Yes, I was trying to use the move command to move a specific folder (such as "C:\Program Files\My Program\*.*"), and all it's subdirectories, to a new folder such as "\\Server Name\Share Name\Backups". I was hoping it would also move (or create) empty folders, and also move any files that had the Read-Only attribute set. I believe the problem was that any Read-Only files would not be copied/moved correctly. I haven't tried this with the new beta 90 release yet however. Thanks again! Jeff Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now