This is the mail archive of the
cygwin
mailing list for the Cygwin project.
add folder name to filename
- From: "Nikolaos A. Patsopoulos" <npatsop at cc dot uoi dot gr>
- To: cygwin at cygwin dot com
- Date: Thu, 14 Sep 2006 15:23:43 +0300
- Subject: add folder name to filename
Hi,
I have
the following structure of folders and files:
..
folder1
file1
file2
folder2
file1
file2
.....
and want to add the folder name into the filename:
folder1
folder1_file1
folder1_file2
folder2
folder2_file1
folder2_file2
I used the following script but doesn't work under cygwin:
for file in folder*/*; do
dir=$(basename $(dirname $file) )
base=$(basename $file)
mv $file $(dirname $file)/${dir}_${base}
done
Does anyone has a suggestion or where I should look?
Thanks in advance,
Nikos
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/