You are not logged in.

#1 2013-08-26 14:32:27

anitac
Member
Registered: 2011-06-15
Posts: 25

Copy directory but only copy filenames, not the contents

I used a command-line program before that copied a directory including its sub-directories and files but it did not copy the contents of the files, just the names. Does anyone know what the name of the program might have been or a way to do this?

Last edited by anitac (2013-08-26 14:32:49)

Offline

#2 2013-08-26 14:39:22

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,547
Website

Re: Copy directory but only copy filenames, not the contents

Just the names?  Do you mean it created new empty files with the same names, or did it create symlinks to the originals?

EDIT: what are you trying to accomplish with this?

Last edited by Trilby (2013-08-26 14:39:52)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2013-08-26 14:41:33

djgera
Developer
From: Buenos Aires - Argentina
Registered: 2008-12-24
Posts: 723
Website

Re: Copy directory but only copy filenames, not the contents

cp -a --atributes-only ...

Offline

#4 2013-08-26 14:51:21

swanson
Member
From: Sweden
Registered: 2011-02-05
Posts: 759

Re: Copy directory but only copy filenames, not the contents

ls /dir > listing.txt

Offline

#5 2013-08-26 14:52:32

anitac
Member
Registered: 2011-06-15
Posts: 25

Re: Copy directory but only copy filenames, not the contents

It created new empty files with the same names.

cp does it, thank you.

Last edited by anitac (2013-08-26 14:55:40)

Offline

#6 2013-08-26 15:03:07

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: Copy directory but only copy filenames, not the contents

djgera wrote:
cp -a --attributes-only ...

Fixed that for ya.

Anyway, thanks. I never would have thought to look to cp for this.


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

Board footer

Powered by FluxBB