public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* add folder name to filename
@ 2006-09-14 12:23 Nikolaos A. Patsopoulos
  2006-09-14 12:30 ` Eric Blake
  0 siblings, 1 reply; 8+ messages in thread
From: Nikolaos A. Patsopoulos @ 2006-09-14 12:23 UTC (permalink / raw)
  To: cygwin

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/

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2006-09-16 12:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-14 12:23 add folder name to filename Nikolaos A. Patsopoulos
2006-09-14 12:30 ` Eric Blake
2006-09-14 12:35   ` Nikolaos A. Patsopoulos
2006-09-14 12:43     ` Eric Blake
2006-09-14 12:53       ` Nikolaos A. Patsopoulos
2006-09-14 13:03       ` Nikolaos A. Patsopoulos
2006-09-14 13:09       ` Nikolaos A. Patsopoulos
2006-09-16 12:35         ` Re[2]: " oleyk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).