- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: rename files script
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
12-01-2004 10:37 AM
12-01-2004 10:37 AM
rename files script
these file names have spcaces in them such as xxx 01 xx 02.dat
what would be a script that i can use that will achieve that?
thanks for the help in advance.
- Tags:
- evil spaces
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2004 10:53 AM
12-01-2004 10:53 AM
Re: rename files script
Give 5 or 6 very specific examples and this should be fairly easy -- especially in Perl but also in the shell.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2004 11:12 AM
12-01-2004 11:12 AM
Re: rename files script
here is a list of some files:
2004-SEP-04_02-43-22_ 0.DAT
2004-SEP-04_03-18-44_ 34.DAT
2004-SEP-04_02-44-24_ 1.DAT
2004-SEP-04_03-19-44_ 35.DAT
2004-SEP-04_02-45-28_ 2.DAT
2004-SEP-04_03-20-44_ 36.DAT
2004-SEP-04_02-46-31_ 3.DAT
2004-SEP-04_03-21-44_ 37.DAT
so what I would like to do is rename all files such as 2004120001 through 2004129999.
file pattern is yyyymm0001 - yyyymm9999.
thanks again for the help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2004 11:19 AM
12-01-2004 11:19 AM
Re: rename files script
File111_xxx.DAT --> 2004120111
File112_ DAT --> 2004120012
or whatever.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2004 11:26 AM
12-01-2004 11:26 AM
Re: rename files script
"2004-SEP-04_02-43-22_ 0.DAT"
the desired output is such as
20041200001 through 2004129999
or really depending on how namy files I have in the directory.
thanks again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2004 11:57 AM
12-01-2004 11:57 AM
Re: rename files script
#!/usr/bin/sh
typeset DESTDIR=/xxx/yyy
if [[ ! -d ${DESTDIR} ]]
then
echo "Copy directory ${DESTDIR} not found" >&2
exit 255
fi
typeset -i I=0
typeset -Z4 Z=0
typeset DESTNAME=""
ls | while read X
do
Z=${I}
DESTNAME="${DESTDIR}/200412${Z}"
echo "File \"${X}\" --> \"${DESTNAME}\""
# cp "${X}" "${DESTNAME}"
# leave above line commented while testing
((I += 1))
done
-------------------------
This should be very close.