FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 09-24-2011, 09:40 AM
Mark Panen
 
Default command to mv files & folders to dir

Hi,

Made a bit off a muck up off things when i backed up parts of my
/home/mark directory to /mnt/deer

In /mnt/deer i know have hundreds of files and folders which i rsynced
on 22/09/2011.

I need a command line option to put them all In one shot in /mnt/deer/zebra.

Mark


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: CABWh29=jQBe+-9OC-=N5Y5PMbUJ8BzfkWUUWvzJRm3O=Vb7LFg@mail.gmail.com"> http://lists.debian.org/CABWh29=jQBe+-9OC-=N5Y5PMbUJ8BzfkWUUWvzJRm3O=Vb7LFg@mail.gmail.com
 
Old 09-24-2011, 09:49 AM
Tom Furie
 
Default command to mv files & folders to dir

On Sat, Sep 24, 2011 at 11:40:48AM +0200, Mark Panen wrote:

> In /mnt/deer i know have hundreds of files and folders which i rsynced
> on 22/09/2011.
>
> I need a command line option to put them all In one shot in /mnt/deer/zebra.

What's wrong with 'mv /mnt/deer/* /mnt/deer/zebra'? Sure, it'll complain
about trying to move zebra to itself, but it works.

Cheers,
Tom

--
There is no substitute for good manners, except, perhaps, fast reflexes.
 
Old 09-24-2011, 09:53 AM
Ivan Shmakov
 
Default command to mv files & folders to dir

>>>>> Mark Panen <mark.panen@gmail.com> writes:

> Made a bit off a muck up off things when i backed up parts of my
> /home/mark directory to /mnt/deer

> In /mnt/deer i know have hundreds of files and folders which i
> rsynced on 22/09/2011.

> I need a command line option to put them all In one shot in
> /mnt/deer/zebra.

It's not what I'd usually call “one shot” (= atomic), but, IIUC,
the following single command line should do it:

$ mkdir -pv -- /mnt/deer/zebra
&& find /mnt/deer/ -maxdepth 1 -mindepth 1 -not -name zebra
-exec mv --target-directory=/mnt/deer/zebra -- {} +

--
FSF associate member #7257 Join news:comp.unix.shell for pretty
much /everything/ related to the POSIX Shell language and its variants.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 86sjnmjmfy.fsf@gray.siamics.net">http://lists.debian.org/86sjnmjmfy.fsf@gray.siamics.net
 
Old 09-24-2011, 10:00 AM
Ivan Shmakov
 
Default command to mv files & folders to dir

>>>>> Tom Furie <tom@furie.org.uk> writes:
>>>>> On Sat, Sep 24, 2011 at 11:40:48AM +0200, Mark Panen wrote:

>> In /mnt/deer i know have hundreds of files and folders which i
>> rsynced on 22/09/2011.

>> I need a command line option to put them all In one shot in
>> /mnt/deer/zebra.

> What's wrong with 'mv /mnt/deer/* /mnt/deer/zebra'? Sure, it'll
> complain about trying to move zebra to itself, but it works.

The other catch is that it won't consider the filenames with a
leading dot, such as ‘.bashrc’.

--
FSF associate member #7257


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 86k48yjm40.fsf@gray.siamics.net">http://lists.debian.org/86k48yjm40.fsf@gray.siamics.net
 
Old 09-24-2011, 10:11 AM
Camalen
 
Default command to mv files & folders to dir

On Sat, 24 Sep 2011 11:40:48 +0200, Mark Panen wrote:

> Made a bit off a muck up off things when i backed up parts of my
> /home/mark directory to /mnt/deer
>
> In /mnt/deer i know have hundreds of files and folders which i rsynced
> on 22/09/2011.
>
> I need a command line option to put them all In one shot in
> /mnt/deer/zebra.

Not a command line but Midnight Commander is very good for such day-to-
day tasks.

Greetings,

--
Camalen


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: pan.2011.09.24.10.11.34@gmail.com">http://lists.debian.org/pan.2011.09.24.10.11.34@gmail.com
 
Old 09-24-2011, 10:31 AM
Ivan Shmakov
 
Default command to mv files & folders to dir

>>>>> Camaleón <noelamac@gmail.com> writes:
>>>>> On Sat, 24 Sep 2011 11:40:48 +0200, Mark Panen wrote:

>> Made a bit off a muck up off things when i backed up parts of my
>> /home/mark directory to /mnt/deer

>> In /mnt/deer i know have hundreds of files and folders which i
>> rsynced on 22/09/2011.

>> I need a command line option to put them all In one shot in
>> /mnt/deer/zebra.

> Not a command line but Midnight Commander is very good for such
> day-to- day tasks.

Following the suggestion of Victor Wagner (in
news:fido7.ru.unix.linux, I believe), I've dropped
Midnight Commander in favor of Bash something like a decade ago.

I've never regret the change.

Midnight Commander may simplify the simple things, but
whatever's your experience with it, the complex tasks are often
impossible. On the contrary, Shell lets one to benefit from the
experience, and the solutions to the simpler tasks could usually
be re-used to solve the more complex ones.

Not to mention that the use of Shell keeps one's mind “in
shape.”

--
FSF associate member #7257


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 86bouajkoc.fsf@gray.siamics.net">http://lists.debian.org/86bouajkoc.fsf@gray.siamics.net
 
Old 09-24-2011, 10:47 AM
Camaleón
 
Default command to mv files & folders to dir

On Sat, 24 Sep 2011 17:31:47 +0700, Ivan Shmakov wrote:

>>>>>> Camaleón <noelamac@gmail.com> writes: On Sat, 24 Sep 2011 11:40:48

> > Not a command line but Midnight Commander is very good for such
> > day-to- day tasks.
>
> Following the suggestion of Victor Wagner (in
news:fido7.ru.unix.linux,
> I believe), I've dropped Midnight Commander in favor of Bash
something
> like a decade ago.
>
> I've never regret the change.
>
> Midnight Commander may simplify the simple things, but whatever's
your
> experience with it, the complex tasks are often impossible.
On
the
> contrary, Shell lets one to benefit from the experience, and the
> solutions to the simpler tasks could usually be re-used to solve
the
> more complex ones.

Midnight Commander is very powerful, I have no complaints over it. It
helped me when I first started managing servers with no GUI and still
find it very useful to run some tasks and to avoid fat fingers errors.

> Not to mention that the use of Shell keeps one's mind “in shape.”

Both (direct typing and MC) are not mutually exclusive. You can use the
best of the two worlds to obtain a better ratio of quickness while
keeping you mind in good shape.

MC does not need vitamins to keep its brain activity always at 100%. I do.

Greetings,

--
Camaleón


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: pan.2011.09.24.10.47.12@gmail.com">http://lists.debian.org/pan.2011.09.24.10.47.12@gmail.com
 
Old 09-24-2011, 10:55 AM
Mark Panen
 
Default command to mv files & folders to dir

On Sat, Sep 24, 2011 at 11:53 AM, Ivan Shmakov <ivan@gray.siamics.net> wrote:
>>>>>> Mark Panen <mark.panen@gmail.com> writes:
>
> *> Made a bit off a muck up off things when i backed up parts of my
> *> /home/mark directory to /mnt/deer
>
> *> In /mnt/deer i know have hundreds of files and folders which i
> *> rsynced on 22/09/2011.
>
> *> I need a command line option to put them all In one shot in
> *> /mnt/deer/zebra.
>
> * * * *It's not what I'd usually call “one shot” (= atomic), but, IIUC,
> * * * *the following single command line should do it:
>
> $ mkdir -pv -- /mnt/deer/zebra
> * * *&& find /mnt/deer/ -maxdepth 1 -mindepth 1 -not -name zebra
> * * * * * * -exec mv --target-directory=/mnt/deer/zebra -- {} +
>
> --
> FSF associate member #7257 * * *Join news:comp.unix.shell for pretty
> much /everything/ related to the POSIX Shell language and its variants.
>
>
> --
> To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
> Archive: http://lists.debian.org/86sjnmjmfy.fsf@gray.siamics.net
>
>

will this mv only the file/folders created on the 22/09/2011, i want
the older files etc to stay behind.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: CABWh29mQ9HMCxKG1XF9mGhUyb5mq0M-wJBV4Hr2J9C9ZBtS-Lw@mail.gmail.com">http://lists.debian.org/CABWh29mQ9HMCxKG1XF9mGhUyb5mq0M-wJBV4Hr2J9C9ZBtS-Lw@mail.gmail.com
 
Old 09-24-2011, 11:09 AM
Andrew McGlashan
 
Default command to mv files & folders to dir

Mark Panen wrote:

Made a bit off a muck up off things when i backed up parts of my
/home/mark directory to /mnt/deer

In /mnt/deer i know have hundreds of files and folders which i rsynced
on 22/09/2011.

I need a command line option to put them all In one shot in /mnt/deer/zebra.


(cd /mnt/deer;mkdir zebra;mv * .* zebra)

And yes, sure it will complain about . and .. as well as zebra, but
it'll work fine for all other files / directories / links.


if there are too many files for the wild cards to work, then you'll have
a bit more fun, let us know. ;-)


Cheers

--
Kind Regards
AndrewM

Andrew McGlashan


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Archive: 4E7DBA5E.4020806@affinityvision.com.au">http://lists.debian.org/4E7DBA5E.4020806@affinityvision.com.au
 
Old 09-24-2011, 11:12 AM
Ivan Shmakov
 
Default command to mv files & folders to dir

>>>>> Mark Panen <mark.panen@gmail.com> writes:
>>>>> On Sat, Sep 24, 2011 at 11:53 AM, Ivan Shmakov wrote:
>>>>> Mark Panen <mark.panen@gmail.com> writes:

>>> Made a bit off a muck up off things when i backed up parts of my
>>> /home/mark directory to /mnt/deer

>>> In /mnt/deer i know have hundreds of files and folders which i
>>> rsynced on 22/09/2011.

>>> I need a command line option to put them all In one shot in
>>> /mnt/deer/zebra.

>> It's not what I'd usually call “one shot” (= atomic), but, IIUC,
>> the following single command line should do it:

>> $ mkdir -pv -- /mnt/deer/zebra
>> && find /mnt/deer/ -maxdepth 1 -mindepth 1 -not -name zebra
>> -exec mv --target-directory=/mnt/deer/zebra -- {} +

> will this mv only the file/folders created on the 22/09/2011, i want
> the older files etc to stay behind.

Somehow, I didn't understood that as part of the task.

The -ctime constraint to find(1) may be helpful here, like:

$ mkdir -pv -- /mnt/deer/zebra
&& find /mnt/deer/
-maxdepth 1 -mindepth 1 -ctime -3 -not -name zebra
-exec mv --target-directory=/mnt/deer/zebra -- {} +

However, note that the Unix' “change time” is /not/ the file
creation time (I know of no Unix filesystem to track the
latter), but they /should/ coincide in this particular case.

Note also that if the filesystem under /mnt is not a Unix one
(such as VFAT), it should be checked whether the ctime is
actually set as desired. Like:

$ LC_ALL=C stat -- /mnt/deer/foobar

(Where foobar is one of the files copied 2011-09-22.) Check if
the Change: field is set to 2011-09-22.

--
FSF associate member #7257 Join news:comp.unix.shell for pretty
much /everything/ related to the POSIX Shell language and its variants.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 867h4yjirp.fsf@gray.siamics.net">http://lists.debian.org/867h4yjirp.fsf@gray.siamics.net
 

Thread Tools




All times are GMT. The time now is 08:50 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org