Re: moving everything except a directory
Hello, you may use find ~ - -exec mv {} BTW: your mail is out of date. best wishes, Stefan --On 30. September 2005 17:40:00 -0500 Brian John <[EMAIL PROTECTED]> wrote: Say I am at ~ and I have 10 directories inside named 1, 2, 3, 4 ,5, 6, 7, 8, 9 and 10. What command can I use to move everything but directory 2? What if I wanted to move everything but directories 2 and 7? I'm not sure how to use the mv command to do this in 1 comand. Thanks /Brian ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]" ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: moving everything except a directory
On Fri, Sep 30, 2005 at 05:40:00PM -0500, Brian John wrote: > Say I am at ~ and I have 10 directories inside named 1, 2, 3, 4 ,5, 6, > 7, 8, 9 and 10. What command can I use to move everything but directory > 2? What if I wanted to move everything but directories 2 and 7? > find ~ -mindepth 1 -maxdepth 1 ! -name 2 -exec mv {} /path/to/new/place find ~ -mindepth 1 -maxdepth 1 ! -name 2 ! -name 7 -exec mv {} /path/to/new/place > I'm not sure how to use the mv command to do this in 1 comand. > > Thanks > > /Brian > ___ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "[EMAIL PROTECTED]" > -- I sense much NT in you. NT leads to Bluescreen. Bluescreen leads to downtime. Downtime leads to suffering. NT is the path to the darkside. Powerful Unix is. Public Key: ftp://ftp.tallye.com/pub/lorenl_pubkey.asc Fingerprint: CEE1 AAE2 F66C 59B5 34CA C415 6D35 E847 0118 A3D2 pgplFCO3nt9k0.pgp Description: PGP signature
Re: moving everything except a directory
I use tar cvf //.tar 1 3 4 5 6 7 8 9 10 cd tar xvf //.tar I usually do cd find . ! -type d -print > files.txt vi files.txt - edit out files I don't want tar cvfT //.tar files.txt cd tar xvf //.tar which lets me copy files beginning with "." in the root of the directory (tar will skip these in the root, copies them in subdirectories). You also have to worry about permissions if there are executables or files you don't own in the directory. There are much neater ways of doing this, but this method leaves a backup copy in the tar file. Mike Squires On Fri, 30 Sep 2005, Brian John wrote: Say I am at ~ and I have 10 directories inside named 1, 2, 3, 4 ,5, 6, 7, 8, 9 and 10. What command can I use to move everything but directory 2? What if I wanted to move everything but directories 2 and 7? I'm not sure how to use the mv command to do this in 1 comand. Thanks /Brian ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]" ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: moving everything except a directory
--- Brian John <[EMAIL PROTECTED]> wrote: > Say I am at ~ and I have 10 directories inside named > 1, 2, 3, 4 ,5, 6, > 7, 8, 9 and 10. What command can I use to move > everything but directory > 2? You can use combination of different commands to solve this problem. Base on your problem, you can move all directories excetp 2. mv `ls -l | grep -v 2 | awk -F " " '{print $9}'` Take note that the above commands do not only move the directories and its contents but also all the files in the current directory. If this is what you want, then the above commands will do it. What if I wanted to move everything but > directories 2 and 7? Just pipe another command,e.g. "grep -v 7", after the first grep command. Another option is to write a script if you want > > I'm not sure how to use the mv command to do this in > 1 comand. > > Thanks > > /Brian > ___ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to > "[EMAIL PROTECTED]" > __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: moving everything except a directory
Am Samstag, 1. Oktober 2005 00:40 CEST schrieb Brian John: > Say I am at ~ and I have 10 directories inside named 1, 2, 3, 4 ,5, 6, > 7, 8, 9 and 10. What command can I use to move everything but directory > 2? What if I wanted to move everything but directories 2 and 7? See regular expressions, for example 'mv ^[2,7] /another/dir' would do the job. You should correct your date! ntpdate is helpful! -Harry > I'm not sure how to use the mv command to do this in 1 comand. > > Thanks > > /Brian > ___ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to > "[EMAIL PROTECTED]" pgp3AzoZBIMop.pgp Description: PGP signature
Re: moving everything except a directory
Brian John wrote: Say I am at ~ and I have 10 directories inside named 1, 2, 3, 4 ,5, 6, 7, 8, 9 and 10. What command can I use to move everything but directory 2? mv 1 3 4 5 6 7 8 9 10 new/ What if I wanted to move everything but directories 2 and 7? mv 1 3 4 5 6 8 9 10 new/ I'm not sure how to use the mv command to do this in 1 comand. man mv SYNOPSIS mv [-f | -i | -n] [-v] source target mv [-f | -i | -n] [-v] source ... directory -Mark ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
moving everything except a directory
Say I am at ~ and I have 10 directories inside named 1, 2, 3, 4 ,5, 6, 7, 8, 9 and 10. What command can I use to move everything but directory 2? What if I wanted to move everything but directories 2 and 7? I'm not sure how to use the mv command to do this in 1 comand. Thanks /Brian ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"