[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: OT (ish): How to copy hidden files/directories



CB wrote:
> I can't figure out how to do this: copy (or move) all the hidden files
> and directories contained in one directory to another directory.
> 
> Is it as embarrasingly simple as I imagine it must be?

Last time this came up, Ulrich Drepper pointed out the
shopt -s dotglob
command.

This makes * match hidden and non-hidden files.

So
shopt -s dotglob
mv $olddir/* $newdir
will move everything, hidden and non-hidden.

Possibly the simplest way to just move hidden would then be to move back
the non-hidden. Or to move them to a safe directory first.

Note that moving files is *fast* if you don't cross filesystems: only
the filesystem structure needs to be updated.

James.
-- 
E-mail address: james | "Drums must never stop. Very bad if drums stop."
@westexe.demon.co.uk  | "Why? What will happen if the drums ever stop?"
                      | "Bass solo."


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]