public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "Nikolaos A. Patsopoulos" <npatsop@cc.uoi.gr>
To: Eric Blake <ebb9@byu.net>
Cc: cygwin@cygwin.com
Subject: Re: add folder name to filename
Date: Thu, 14 Sep 2006 12:35:00 -0000	[thread overview]
Message-ID: <45094C90.3010804@cc.uoi.gr> (raw)
In-Reply-To: <45094B84.6010009@byu.net>

Eric Blake wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> According to Nikolaos A. Patsopoulos on 9/14/2006 6:23 AM:
>   
>> 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
>>     
>
> What is the actual error message you are seeing?  But I bet the problem is
> due to your missing quoting, so your problem is not cygwin-specific.  I
> would guess that you are having issues due to spaces or other shell
> metacharacters in the filenames being interpreted literally.
>
>   
>> Does anyone has a suggestion or where I should look?
>>     
>
> A good tutorial on shell programming?  Hint:
>
> for file in folder*/*; do
>      dir=$(basename "$(dirname "$file")")
>      base=$(basename "$file")
>      mv "$file" "$(dirname "$file")/${dir}_${base}"
> done
>
> (That won't work on filenames with \n as the last character, but
> fortunately, unless you use cygwin managed mounts, that is not an issue on
> cygwin).
>
> - --
> Life is short - so eat dessert first!
>
> Eric Blake             ebb9@byu.net
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.2.1 (Cygwin)
> Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFFCUuD84KuGfSFAYARAn1BAJ41A85ZHvKBAWtKa3tWKO+4fLrh5gCgkw+j
> fzK7C9kby5r6M26SQQk2pvo=
> =CZVE
> -----END PGP SIGNATURE-----
>
>
>   
I get the same error with my code and yours:

Script started, file is typescript

nothing happens, except an empty file called typescript in the parent 
directory


--
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/

  reply	other threads:[~2006-09-14 12:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-14 12:23 Nikolaos A. Patsopoulos
2006-09-14 12:30 ` Eric Blake
2006-09-14 12:35   ` Nikolaos A. Patsopoulos [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45094C90.3010804@cc.uoi.gr \
    --to=npatsop@cc.uoi.gr \
    --cc=cygwin@cygwin.com \
    --cc=ebb9@byu.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).