ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using VBA to move system files (https://www.excelbanter.com/excel-programming/443869-using-vba-move-system-files.html)

Andrew[_56_]

Using VBA to move system files
 
Hello,
I have the task of sorting though thousands of music files all of
which all reside in their own folders. There is one main folder
called MUSIC. In that folder is about 2800 folders, each of which has
one or more mp3 files in it. I'd like to write a program which will
scan all of those folders and move (not copy) all of the mp3 files
into one common folder. Can this be done in VBA? If so, please help
me out with some required system commands.

thanks,
Andy

Harald Staff[_2_]

Using VBA to move system files
 
HI Andy

Here's how to move a file:

Sub test()
Name "C:\Temp\File.txt" As "D:\Folder\File0001.txt"
End Sub

For all files in a folder with or without subfolders there are plenty of
solutions. Here are first three from googling
vba all files in folder:

http://www.vbaexpress.com/kb/getarticle.php?kb_id=245

http://www.freevbcode.com/ShowCode.Asp?ID=1487

http://www.exceltip.com/st/List_file...Excel/446.html

HTH. Best wishes Harald


"Andrew" wrote in message
...
Hello,
I have the task of sorting though thousands of music files all of
which all reside in their own folders. There is one main folder
called MUSIC. In that folder is about 2800 folders, each of which has
one or more mp3 files in it. I'd like to write a program which will
scan all of those folders and move (not copy) all of the mp3 files
into one common folder. Can this be done in VBA? If so, please help
me out with some required system commands.

thanks,
Andy



Andrew[_56_]

Using VBA to move system files
 
Thanks Harald. That looks like what I need.

Andy

On Nov 10, 12:32*am, "Harald Staff" wrote:
HI Andy

Here's how to move a file:

Sub test()
Name "C:\Temp\File.txt" As "D:\Folder\File0001.txt"
End Sub

For all files in a folder with or without subfolders there are plenty of
solutions. Here are first three from googling
vba all files in folder:

http://www.vbaexpress.com/kb/getarticle.php?kb_id=245

http://www.freevbcode.com/ShowCode.Asp?ID=1487

http://www.exceltip.com/st/List_file...Microsoft_Scri...

HTH. Best wishes Harald

"Andrew" wrote in message

...

Hello,
I have the task of sorting though thousands of music files all of
which all reside in their own folders. *There is one main folder
called MUSIC. *In that folder is about 2800 folders, each of which has
one or more mp3 files in it. *I'd like to write a program which will
scan all of those folders and move (not copy) all of the mp3 files
into one common folder. *Can this be done in VBA? *If so, please help
me out with some required system commands.


thanks,
Andy



Dave Peterson[_2_]

Using VBA to move system files
 
Just a warning/question...

Won't you have to worry about MP3 files in different starting folders that share
the same name?

I'd copy them to the combined folder and only delete them if the copy didn't
cause heartache.

ps.

When I want to do this kind of thing, I'll use windows explorer's search to
search for *.mp3 files.

Then I could select all of the files in the results window and hit ctrl-x.

Then paste them where I want.

But I'd be careful with the duplicate names destroying files here, too.



On 11/09/2010 20:50, Andrew wrote:
Hello,
I have the task of sorting though thousands of music files all of
which all reside in their own folders. There is one main folder
called MUSIC. In that folder is about 2800 folders, each of which has
one or more mp3 files in it. I'd like to write a program which will
scan all of those folders and move (not copy) all of the mp3 files
into one common folder. Can this be done in VBA? If so, please help
me out with some required system commands.

thanks,
Andy


--
Dave Peterson

Harald Staff[_2_]

Using VBA to move system files
 
You're right Dave. "Born to Run" by Bruce might be overwritten by some
Karaoke version.
Additional information needed is probably in John's page
http://spreadsheetpage.com/index.php...3_file_lister/ but Bruce
Karaoke is not easy to hardcode.

Best wishes Harald

"Dave Peterson" wrote in message
...
Just a warning/question...

Won't you have to worry about MP3 files in different starting folders that
share the same name?

I'd copy them to the combined folder and only delete them if the copy
didn't cause heartache.

ps.

When I want to do this kind of thing, I'll use windows explorer's search
to search for *.mp3 files.

Then I could select all of the files in the results window and hit ctrl-x.

Then paste them where I want.

But I'd be careful with the duplicate names destroying files here, too.



On 11/09/2010 20:50, Andrew wrote:
Hello,
I have the task of sorting though thousands of music files all of
which all reside in their own folders. There is one main folder
called MUSIC. In that folder is about 2800 folders, each of which has
one or more mp3 files in it. I'd like to write a program which will
scan all of those folders and move (not copy) all of the mp3 files
into one common folder. Can this be done in VBA? If so, please help
me out with some required system commands.

thanks,
Andy


--
Dave Peterson



Andrew[_56_]

Using VBA to move system files
 
On Nov 10, 11:27*am, "Harald Staff" wrote:
You're right Dave. "Born to Run" by Bruce might be overwritten by some
Karaoke version.
Additional information needed is probably in John's pagehttp://spreadsheetpage.com/index.php/file/mp3_file_lister/but Bruce
Karaoke is not easy to hardcode.

Best wishes Harald

"Dave Peterson" wrote in message

...

Just a warning/question...


Won't you have to worry about MP3 files in different starting folders that
share the same name?


I'd copy them to the combined folder and only delete them if the copy
didn't cause heartache.


ps.


When I want to do this kind of thing, I'll use windows explorer's search
to search for *.mp3 files.


Then I could select all of the files in the results window and hit ctrl-x.


Then paste them where I want.


But I'd be careful with the duplicate names destroying files here, too.


On 11/09/2010 20:50, Andrew wrote:
Hello,
I have the task of sorting though thousands of music files all of
which all reside in their own folders. *There is one main folder
called MUSIC. *In that folder is about 2800 folders, each of which has
one or more mp3 files in it. *I'd like to write a program which will
scan all of those folders and move (not copy) all of the mp3 files
into one common folder. *Can this be done in VBA? *If so, please help
me out with some required system commands.


thanks,
Andy


--
Dave Peterson


Thanks. That is a good thing to consider. I hadn't thought about the
more simpler method of using explorer to find all mp3s. Sometimes I
think I look for excuses to write programs.


All times are GMT +1. The time now is 11:31 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com