Mailinglist Archive: opensuse (4393 mails)
| < Previous | Next > |
Re: [SLE] shell script help
- From: Alexandr Malusek <Alexandr.Malusek@xxxxxxxxxx>
- Date: 26 Nov 2001 13:36:32 +0100
- Message-id: <867ksdiu9b.fsf@xxxxxxxxxxxxxxxxx>
Eddie Howson <eddie@xxxxxxxxxxxxx> writes:
> I tried using your script and it worked perfectly. If I may impose on you
> further, how can I make this script work recursively so that it functions on
> any subdirectory, while ensuring that it does not enter directories above the
> one that it is started in?
Try
find . -type f -printf "'%p'\n'%h/%u_%f'\n" | xargs -n 2 echo
and if the output is OK then replace echo with mv. It may not work for
files containing apostrophes (and perhaps some other unusual
characters) in their names.
--
Alexandr.Malusek@xxxxxxxxxx
> I tried using your script and it worked perfectly. If I may impose on you
> further, how can I make this script work recursively so that it functions on
> any subdirectory, while ensuring that it does not enter directories above the
> one that it is started in?
Try
find . -type f -printf "'%p'\n'%h/%u_%f'\n" | xargs -n 2 echo
and if the output is OK then replace echo with mv. It may not work for
files containing apostrophes (and perhaps some other unusual
characters) in their names.
--
Alexandr.Malusek@xxxxxxxxxx
| < Previous | Next > |