Hi,
Am trying to copy all the directories alone within a directory. I tried something like

ls -ltr | awk '$1 ~/^d/{print $8} ' | xargs cp -r dest_dir

the first part

ls -ltr | awk '$1 ~/^d/{print $8} '

gives O/P
Testing

But it keeps saying cp cannot access Testing.
Testing folder has rwx permissions for everyone.

Try this instead:

find path-to-dir -maxdepth 1 -type d -exec cp -rfp {} path-to-backup-dir \;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.