- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: file renames -
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-11-2004 05:42 AM
тАО11-11-2004 05:42 AM
I am wanting to put some organization to it, consolidating this stuff into
one location after it's been used. I've have problems in the past with duplicate
files names, I think I may be on to a creation but want to run it by the scripts
gurus.
Here is what I am thinking, see if I am full of it.
#!/bin/sh
for fn1 in `ls -la |awk '{print $4}'
do
export fn2=`date +%Y%j%H%M%S`$fn1.ext
mv $fn1 $fn2
done
By doing this I am retaining the original name in the file name, but, creating a uniq file based on the "date stamp"
Anyone with a better way? or suggestions appreciated.
Solved! Go to Solution.
- Tags:
- date
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-11-2004 05:52 AM
тАО11-11-2004 05:52 AM
Re: file renames -
Anil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-11-2004 05:56 AM
тАО11-11-2004 05:56 AM
Re: file renames -
#!/bin/sh
find . -type f | while read fn1
do
export fn2=$(date +%Y%j%H%M%S)${fn1}.ext
mv ${fn1} ${fn2}
done
This would mean being careful about subdirectories though.
HTH
Duncan
I am an HPE Employee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-11-2004 05:57 AM
тАО11-11-2004 05:57 AM
Re: file renames -
Thanks for the PID idea.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-11-2004 06:01 AM
тАО11-11-2004 06:01 AM
Re: file renames -
The file they build has an extension of ".saf" I was thinking to avoid the directories" i'd change my ls -la to add
ls -la *.saf
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-11-2004 06:05 AM
тАО11-11-2004 06:05 AM
Re: file renames -
Brother.
Several of the file were named like:
November balance sheet.saf
September 10 posting.saf
ARGGH!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-11-2004 06:13 AM
тАО11-11-2004 06:13 AM
Re: file renames -
Instead of 'for' try 'while'. In case if the filenames have spaces in them, 'for' wont' work
ls -1 | while read
do
mv "$fn1" "$fn2"
done
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-11-2004 06:15 AM
- Tags:
- read
- while loop
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-11-2004 06:27 AM
тАО11-11-2004 06:27 AM
Re: file renames -
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-11-2004 06:39 AM
тАО11-11-2004 06:39 AM