- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Renaming Files
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
Forums
Discussions
Discussions
Discussions
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
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
02-06-2002 07:32 AM
02-06-2002 07:32 AM
thanks in advance,
Christian Briddon
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2002 07:36 AM
02-06-2002 07:36 AM
Re: Renaming Files
mv filename filename.`date +%d%m%y`
Note that the ` marks are the backwards tick marks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2002 07:39 AM
02-06-2002 07:39 AM
Re: Renaming Files
If you man the date command, it will guide you through exactly what you need. However, are you sure that you want file.06/02/2002 rather than something like file.06-02-2002. You method will create a subdirectory, is that what you want?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2002 07:39 AM
02-06-2002 07:39 AM
Re: Renaming Files
It should work except the for logfiles etc...
In such case why not copy the file, append the date and zeroe your file:
cp -p file file.
date>>file.
>file
No garanty, just thoughts...
All the best
Victor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2002 07:40 AM
02-06-2002 07:40 AM
Re: Renaming Files
# mv file file.$(date +%d%m%y)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2002 07:40 AM
02-06-2002 07:40 AM
Re: Renaming Files
Try this:
# mv /tmp/me /tmp/me.`date +%d_%m_%Y`
Remember to avoid the usual "/" in the date since this would constitute additional directory levels.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2002 07:46 AM
02-06-2002 07:46 AM
Re: Renaming Files
As Patrick tell you, you can do:
mv filename filename.`date +%d%m%y`
and then echo `date` >> filename.`date +%d%m%y`
Regards,
Justo.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2002 07:51 AM
02-06-2002 07:51 AM
SolutionAs everybody already said
no / it is not possible.
You can even add time in the date incase you need to rename more than once a day.
cp file file..$(date '+%d-%m-%y_%H:%M:%S')
Shame. But choose another character in the date.
Steve Steel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2002 08:03 AM
02-06-2002 08:03 AM
Re: Renaming Files
Personally, I prefer
# mv logfile logfile.`date +%Y%m%d`
This makes sorting the logfiles in chronological order much easier.
Hope this helps. Regards.
Steven Sim Kok Leong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2002 08:22 AM
02-06-2002 08:22 AM
Re: Renaming Files
Cheers,
Christian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2002 11:15 PM
02-06-2002 11:15 PM
Re: Renaming Files
the solution for your problem is very easy:
mv oldname oldname.`date +%d.%m.%y`
It is better to use dots as separators than slashes because these could be interpreted as pathes. You can use each character as seperator but allways be careful with special characters for the reason the shell could interpret them!
I hope this will help you, best regards
Peter Kloetgen