i want to write 2 batch files.
1st:
move all files in subdirs to root dir.
eg:
Folder1
|_folder2
|___files.jpg
|_folder3
|___files.jpg
i want to move all files in folders of folder1 to folder1
2nd batch file is
eg:
Folder1
|_folder2
|___JPEG
|_____files.jpg
|_folder3
|___JPEG
|_____files.jpg
Need to Delete all files in sub dir then move files from JPEG one level up -to folder2 for example- and rename it to thumbnail.png for example.
i tryed
for /r %%f in (*) do ren "%%f" thumbnail.jpg
to rename all files but dont know how to delete all files in same folder that containe jpeg folder and how to move files one level up.
Thankx 😀 hope its not vey complex
Here’s a solution to your first question, as I understand it:
As I’ve written it all files at any level are moved. If you only want first level subdirectory files moved, then get rid of the /s.
For your second problem, try a similar approach, but with
to list all the entries that aren’t sub-directories (ie, skip JPEG). This will let you construct the for statement that does the deletion, then do another statement that does the move and rename.
You might want to look at calling a sub-routine to do the move, rename, delete. You could then manipulate the filename to change the name. I’m a bit confused about exactly what you want to do in the second case. Also have a look a the help on the set and call commands if your not sure about extracting the filename and other string manipulations.
If you add comments or edit your question to show exactly what you want then I’m happy to help further.