X-Spam-Check-By: sourceware.org Message-ID: <450949CF.5050306@cc.uoi.gr> Date: Thu, 14 Sep 2006 15:23:43 +0300 From: "Nikolaos A. Patsopoulos" User-Agent: Thunderbird 1.5.0.5 (Windows/20060719) MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: add folder name to filename Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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/