- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- need some scripting help
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
11-02-2004 06:28 AM
11-02-2004 06:28 AM
need some scripting help
thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2004 06:44 AM
11-02-2004 06:44 AM
Re: need some scripting help
You can try something like this
# vi /usr/local/bin/flist
/source/dir/file1
/source/dir/file2
/source/dir/file3
#
# export TARGET_DIR=/target/dir
# FAILED=0
# for FILE_NAME in $(cat /usr/local/bin/flist)
do
mv $FILE_NAME $TARGET_DIR/
[ $? -ne 0 ] && FAILED=1
done
#
# [ $FAILED -eq 0 ] && echo "Move successful" || echo "Move unsuccessful"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2004 06:47 AM
11-02-2004 06:47 AM
Re: need some scripting help
Is this what you want to do.
source_dir=/test
dest_dir=/test
all files in /test that has *.org extn, you want to move to /test1.
you can do this from the command line
pwd
/test
# for i in `ls -l *.org |awk '{print $9}'`
>do
>mv $i /test1
>done
Hope this helps.
Regds
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2004 06:57 AM
11-02-2004 06:57 AM
Re: need some scripting help
Change:
for i in `ls -l *.org |awk '{print $9}'`
to
for i in `ls -1 *.org`
Changes ls -l "el"
to ls -1 "one"
Saves the awk processing. Probably a meaningless improvement.
Nice job itrc colleagues.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2004 07:36 AM
11-02-2004 07:36 AM
Re: need some scripting help
Hope I understand you correct. You have a list of files, all in the same directory and want to move to a different directory.
while read file
do
mv $file /
done