Could any of you help me with a problem I have with a lot of files with the same name, placed in sperate folders.
The folders are named with numbers, but the files inside are named index.XXXX - where XXXX could be .jpg or .html or .pdf.
I would like to make a 'program' that can rename all the 'index' files to the same name as the folder they are placed in.
The folders are named with 6 digit numbers - all different.
After this hopefully has been done, then I would like to move all the renamed files to a new single folder, so it will be easier for me to see the whole content.
Looking forward to reading your answers.
相关问题
- What is the best way to do a search in a large fil
- Spring Integration - Inbound file endpoint. How to
- Is it possible to define a 'move-and-swap idio
- xcopy include folder
- Batch file if string starts by
相关文章
- What is the correct way to declare and use a FILE
- Making new files automatically executable?
- Extracting columns from text file using Perl one-l
- How to serialize data into indented json [duplicat
- Creating a custom file like object python suggesti
- What is the parameter “index” in Pandas.DataFrame.
- How can one batch file get the exit code of anothe
- Sorting a data stream before writing to file in no
Tested folder structure:
Output:
set
a variable to 1000000..1999999 if 6-digit nameECHO
the move command (remove ECHO keyword to perform move)Annotated test structure:
Results:
I agree with Brandon that the Bulk File Rename (http://www.bulkrenameutility.co.uk/) is a great way to rename/suffix the files with their directory names under Windows.
To copy all the renamed files to a common directory, use Windows Explorer to do a search for all the filenames with a with a wildcard (e.g. readme*.txt). Then select all the found files, select copy, navigate to the target directory, and paste.
If you want a GUI to do all the above, Use Bulk File Rename.
Open it up, Browse to your folder. Now check the Sub Folders option in the Selections tab. All your files under the folders will be listed. Select the files in the browser.
In the File tab switch the first option from Keep to Remove. Then go to the Append Folder Name tab and set option Prefix for property Name. Click on Rename to complete.
The advantage with this is that it shows you a preview of what your files will be renamed to.