* 2010-02-28 15:13 (+0100), Vadkan Jozsef wrote:
> I just want to modify the names of some files, but I can't do it if
> they have their full path "in their names"..
Maybe basename and dirname commands could help?
$ basename /foo/bar/file.txt
file.txt
$ dirname /foo/bar/file.txt
/foo/bar
So, if you need to rename files with a shell script you could do
something like this:
#!/bin/sh
for f in "$@"; do
base=$(basename -- "$f")
dir=$(dirname -- "$f")
new="whatever-$base" # Some magic to create new name
mv -- "$f" "$dir/$new"
done
The you can have full paths in "$@" and the script handles them just
fine.
--
Feel free to Cc me your replies if you want to make sure I'll notice
them.
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]
Archive: http://lists.debian.org/[email protected]