Re: [SLUG] File Renaming

From: Levi Bard (levi@bard.sytes.net)
Date: Fri Aug 20 2004 - 16:05:33 EDT


My contribution:

---
#!/bin/sh
# renamemany.sh
# renames all files in given directories from /path/to/file  -> 
/path/to/path-to-file
# Usage: renamemany.sh dir1 dir2 dir3 ...

for dir in "$@" do for i in `find "${dir}" -name '*' | grep '/[^$]'` do ipath=`echo "$i" | sed 's,/[^/]*$,/,'` newname=`echo "$i" | sed 's,/,-,g'` mv -i "$i" "${ipath}${newname}" done done --- ----------------------------------------------------------------------- This list is provided as an unmoderated internet service by Networked Knowledge Systems (NKS). Views and opinions expressed in messages posted are those of the author and do not necessarily reflect the official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 15:04:10 EDT