![]()
[<<]Message[>>] [<<]Author[>>] [<<]Subject[>>] [<<]Thread[>>]
Number : 2536 Date : 2002-07-24 Author : Garry Deane Subject : Re: Moving mass files Size(KB) : 2
--- In xxcopy@y..., "d7legra" wrote: > This moved all of my files into the C:\mp3\artists folder, instead of > the folder for each separate artist. > On the assumption that you are using NT/W2k/XP, the following batch file will move all *.mp3 files which are SIX levels below the root (C:\mp3\artist\a\acdc\album\*.mp3) up 2 levels. Because it will only move files that are 6 levels deep, I am assuming that these will only be the newly acquired and sorted files - the rest will be left alone. Copy the text below into a text editor and save it as say MoveMP3.bat in C:\ or somewhere in your path (type PATH in a CMD Prompt window to see what your path is). Once the files have been moved to the correct location, you can then use Xxcopy to update newer files to the F: drive. In fact if you're feeling adventurous, you could modify the batch commands to do this directly to the F: drive by using Xxcopy instead of Move. (Replace everything between the brackets with Xxcopy "%%i" "F:%% ~pi\.." /bu/bn). What the first command does is create a directory listing of all the .MP3 files in C:\mp3. This list is then piped to the Findstr command to extract only those files that have at least 6 \'s in their path (the .*\\ finds any text then \). Note that if there are also .mp3 files 7 levels down, these will also be moved up 2 levels which is not what you want but I assume this is not an issue. This list is then saved to new_mp3.txt. The next FOR command reads this list and for each entry in the list: 1. Displays a message about the file being moved 2. Moves the file up 2 levels 3. If there is an error, the file already exists in the higher level directory so it deletes the one at the lower level. I'd suggest that you experiment with a partial copy of your data in a different directory first to make sure that it works the way you want. Just change C:\mp3 to point to the test directory. If your data is at a lower or higher level than 6 deep, adjust the number of .*\\ in the Findstr part. Once you're happy that everything is working correctly, just add your xxcopy command onto the end of the batch file after the last ). @echo off dir /b/s C:\mp3\*.mp3|findstr /r \\.*\\.*\\.*\\.*\\.*\\ > new_mp3.txt for /f "tokens=*" %%i in (new_mp3.txt) do ( echo Moving %%i move "%%i" "%%~dpi\..\.." 1>nul 2>&1 if errorlevel 1 del "%%i" > nul ) Garry
This message if part of XXCOPY's message Archive. The archive contains all the messages posted at Yahoo!Groups: XXCOPY.