- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- moving 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
Forums
Discussions
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
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
05-04-2004 08:02 PM
05-04-2004 08:02 PM
For example:
mv ./bla/dir1/subdir1/*.html ./bla/dir1/
mv ./bla/dir2/subdir2/*.html ./bla/dir2/
mv ./bla/dir2/subdir2/1/*.html ./bla/dir2/subdir2/
...
I have tried the following:
find . -name *.html|xargs -i -p mv {} ../{}
(-p for interactivity)
which does not work (of course). The output is:
mv ./bla/dir1/subdir1/doc1.html .././bla/dir1/subdir1/*.html ?...
Not beeing familiar with awk or sed I'd like to know how to replace the string before the last slash to "..".
Or is there a better way of doing this?
Thanks,
Aleks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2004 08:39 PM
05-04-2004 08:39 PM
Re: moving files
mv ./bla/dir1/subdir1/*.html ./bla/dir1/
and Also What you are expecting exactly!! whether you want to move that same in one single command
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2004 08:48 PM
05-04-2004 08:48 PM
Re: moving files
Can get xargs to work either! Anyway, test this :
find . -name '*.html' | while read line
do
echo mv $line `dirname $line | sed -e 's@\/[^\/]*$@@'`
done
Cheers
Nicolas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2004 09:37 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2004 10:01 PM
05-04-2004 10:01 PM
Re: moving files
With the hints from you I made the following script ($1 being the wanted files(s) ):
CUR_DIR=`pwd`
# Remove . from results of find
FILES=`find . -name $1 | cut -c 2-`
for file in $FILES
do
# Construct absolute path
file=$CUR_DIR$file
cd `dirname $file`
mv `basename $file` ../
done
cd $CUR_DIR
Aleks