Rename files based on folder name
Posted: 03 Nov 2014 17:50
Hi
Is there any quick method to rename files in folders based on folder name where they are? For example I "have" folder named DATA under My Documents. And under there are sub-folders "2012", "2013", "2014". In each of this folder there are several files with different extensions (info.txt, sample.jpg, test.avi, etc). Now how to get these files renamed to 2012.txt, 2012.jpg, 2012.avi; 2013.txt, 2013.jpg, 2013.avi; 2014.txt, 2014.jpg, 2014.avi? If I'm in 2012 folder then I can use <curfolder> pattern in Batch Rename and it does the job. But I have hundreds of such folders and doing it manually in each of these folders is time consuming. If I do branch view in DATA folder to see all files in sub-folders and select all these files then I end up with every file being renamed to DATA.txt; DATA.jpg, DATA.avi in each folder. And this what I do not want.
I tried program named Advanced Renamer and there is possible to use such variable as <DirName:1> which gives exactly what I want. Number in it marks folders starting counting from file and goes up. <DirName:1> is folder name where current file is (first folder). <DirName:2> there would go 1 folder up meaning second folder up from file. In my case it would give DATA. Using <DirName:3> would go again 1 folder up and give My Documents, etc. Very easy to handle and this would be exactly what I need.
And now if we go back to topic then question is is this achievable somehow in XYplorer too?
Is there any quick method to rename files in folders based on folder name where they are? For example I "have" folder named DATA under My Documents. And under there are sub-folders "2012", "2013", "2014". In each of this folder there are several files with different extensions (info.txt, sample.jpg, test.avi, etc). Now how to get these files renamed to 2012.txt, 2012.jpg, 2012.avi; 2013.txt, 2013.jpg, 2013.avi; 2014.txt, 2014.jpg, 2014.avi? If I'm in 2012 folder then I can use <curfolder> pattern in Batch Rename and it does the job. But I have hundreds of such folders and doing it manually in each of these folders is time consuming. If I do branch view in DATA folder to see all files in sub-folders and select all these files then I end up with every file being renamed to DATA.txt; DATA.jpg, DATA.avi in each folder. And this what I do not want.
I tried program named Advanced Renamer and there is possible to use such variable as <DirName:1> which gives exactly what I want. Number in it marks folders starting counting from file and goes up. <DirName:1> is folder name where current file is (first folder). <DirName:2> there would go 1 folder up meaning second folder up from file. In my case it would give DATA. Using <DirName:3> would go again 1 folder up and give My Documents, etc. Very easy to handle and this would be exactly what I need.
And now if we go back to topic then question is is this achievable somehow in XYplorer too?