PDA

View Full Version : Solved: Simple way of moving all files in a folder



vodkasoda
03-31-2009, 03:55 PM
Here is some very simplistic code that doesn't work ... I have looked around this site and others and there appear to be some very complicated ways of doing what I want to do ... is there a simple way :think: ?!?!?

MkDir ("E:\MyLeagueOld)

Name "E:\MyLeague\*.txt" As "E:\MyLeagueOld\*.txt"
Name "E:\MyLeague\*.pdf" As "E:\MyLeagueOld\*.pdf"
Name "E:\MyLeague\*.xls" As "E:\MyLeagueOld\*.xls"
Name "E:\MyLeague\*.doc" As "E:\MyLeagueOld\*.doc"

Kenneth Hobs
03-31-2009, 05:28 PM
ChDrive "E"
MkDir "E:\MyLeagueOld"
Shell "cmd /c move /y " & _
"""" & "E:\MyLeague\*.txt" & """" & " " & _
"""" & "E:\MyLeagueOld" & """", vbHide

Change /c to /k and vbHide to vbNormalFocus if you want to see the results.

We could have used Dir() to iterate the folder's file names and used Name.

vodkasoda
04-01-2009, 11:29 AM
Brilliant, thanks Kenneth ...