LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS
User Name
Password
CentOS This forum is for the discussion of CentOS Linux. Note: This forum does not have any official participation.

Notices


Reply
  Search this Thread
Old 05-09-2017, 04:59 AM   #1
robertkwild
Member
 
Registered: Feb 2015
Posts: 382

Rep: Reputation: Disabled
copying a a directory with sub folders changes names


hi all,

im having a problem when copying a folder with sub folders to another host

it copys but some sub folders are renamed ie (Y4567~U) they use the same syntax but jumble up letters and numbers

has anyone noticed this?

many thanks,

rob
 
Old 05-09-2017, 05:06 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,998

Rep: Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338
looks like you gave no usable information, just told us a few words about a "strange" thing.
Would be nice to explain what did you try exactly (what commands, what system ....), what did you expect and what's happened (instead)...
 
Old 05-09-2017, 05:28 AM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,770

Rep: Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933Reputation: 5933
In addition, how are you copying the folders, via samba etc? What OS is the client/server?
Are you copying to a linux or windows file system.

Basically the folder/file names are being mangled. Do the original folders contain spaces or special characters?
 
Old 05-09-2017, 06:21 AM   #4
robertkwild
Member
 
Registered: Feb 2015
Posts: 382

Original Poster
Rep: Reputation: Disabled
im doing this command, same thing happens when i use the rsync command instead -

cp -R /vol/cha-work/_ARCHIVE/to_be_archived/audio/chad_r/Even\ When\ I\ Fall\ -\ January\ 2017\ Project/ /mnt/archive/temp/

or

rsync -a /vol/cha-work/_ARCHIVE/to_be_archived/audio/chad_r/Even\ When\ I\ Fall\ -\ January\ 2017\ Project/ /mnt/archive/temp/

i attach the screenshot with the wierd naming conventions

https://s28.postimg.org/vq36jhwz1/name_changes.png

Last edited by robertkwild; 05-09-2017 at 06:26 AM.
 
Old 05-09-2017, 06:51 AM   #5
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,998

Rep: Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338
do you mean the first 3 directories?
I would say those are the DOS short names of those directories. I don't know why they were used instead of the full names. Is it ntfs?
 
Old 05-09-2017, 07:27 AM   #6
robertkwild
Member
 
Registered: Feb 2015
Posts: 382

Original Poster
Rep: Reputation: Disabled
ive worked out another way to do it, but i need help

once in the directory im going to run a find/exec command something like

find -type d -exec "*" {} \;

so basically this will find any sub dir and once it finds any sub dir it will still keep the same syntax as thats what i think " " does, do anything inbetween the "" will stay the same?

Last edited by robertkwild; 05-09-2017 at 07:28 AM.
 
Old 05-09-2017, 08:05 AM   #7
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,553

Rep: Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498
You haven't answered the questions asked in post 3, what OS are you using and what filesystem from/to?

You escaped the spaces in the name of the parent directory in your command(s) but you also have spaces in the sub-directories. I avoid using spaces in folder/file names so I'm not sure what the solution would be. Your images are from a windows system, does the copying work from windows?
 
Old 05-09-2017, 08:13 AM   #8
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
Originally Posted by robertkwild View Post
ive worked out another way to do it, but i need help

once in the directory im going to run a find/exec command something like

find -type d -exec "*" {} \;

so basically this will find any sub dir and once it finds any sub dir it will still keep the same syntax as thats what i think " " does, do anything in between the "" will stay the same?
remember or have you even used find before?

what basic information are you missing?


Code:
find /home/userx/scripts -type f -name "*" -exec cp -r {} /home/userx/testscript \;

Last edited by BW-userx; 05-09-2017 at 08:14 AM.
 
Old 05-09-2017, 09:46 AM   #9
robertkwild
Member
 
Registered: Feb 2015
Posts: 382

Original Poster
Rep: Reputation: Disabled
thanks
 
Old 05-09-2017, 01:52 PM   #10
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,998

Rep: Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338
?
what is -name "*" good for?
what is cp -r if you run find with -type f ?
 
1 members found this post helpful.
Old 05-09-2017, 02:01 PM   #11
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
Originally Posted by pan64 View Post
?
what is -name "*" good for?
what is cp -r if you run find with -type f ?
are you seriously asking me?

it is not an actual this will work for you line of commands.
I would think:
you should know what -name "*" looks for
you should know what -type f means
you should know what cp -r does
you removed this ---> -exec that g0es to this ---> cp -r

so the line of progress is

find files anything then copy recursively to ---> path given... again it is not a this is what you need command line ..

it is this is the "shell pattern" you need to use just plug in what you need to make it work for you set of commands

because this will defiantly not work,

find -type d -exec "*" {} \;

cha cha cha changes ...

find [path] -type d -exec (wrong place --> "*") {} \;

find [path] -type d -exec mv -t {} [path] \;

but then what happens?

Code:
find path/* -type d -exec cp -r {} [destanation] \;

Last edited by BW-userx; 05-09-2017 at 02:16 PM.
 
Old 05-09-2017, 02:05 PM   #12
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,998

Rep: Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338Reputation: 7338
Quote:
Originally Posted by BW-userx View Post
you should know what -name "*" looks for
nothing, find will do the same thing with and without this.
Quote:
Originally Posted by BW-userx View Post
you should know what -type f means
yes, that means find files
Quote:
Originally Posted by BW-userx View Post
you should know what cp -r does
yes, copy directories recursively

so how do you find files and copy recursively?
 
Old 05-09-2017, 02:23 PM   #13
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
Originally Posted by pan64 View Post
nothing, find will do the same thing with and without this. <--- key phrase with or without

yes, that means find files

yes, copy directories recursively <--- give him a chance to figure it out...

so how do you find files and copy recursively?
refresh and look again at my post to you.

give no credit to the other for the abiltiy to think
and leave nothing to thought ...
and take no prisoners.

Last edited by BW-userx; 05-09-2017 at 02:33 PM.
 
Old 05-10-2017, 03:41 AM   #14
robertkwild
Member
 
Registered: Feb 2015
Posts: 382

Original Poster
Rep: Reputation: Disabled
i get this -

[root@archive Even When I Fall - January 2017 Project]# ls
Even When I Fall_Deliverables Even When I Fall_From Cutting Room Even When I Fall_Mix Session LtRt Stems for Editor
Even When I Fall_Dialogue Even When I Fall_Fx Even When I Fall_Music temp
[root@archive Even When I Fall - January 2017 Project]#
Code:
find . -type d -name "*" -exec cp -R /mnt/archive/temp/ {} \;
cp: cannot stat ‘./Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /Even When I Fall_Deliverables /temp’: File name too long

Last edited by robertkwild; 05-10-2017 at 03:42 AM.
 
Old 05-10-2017, 08:15 AM   #15
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
did you read that tail end message that says this is why cannot stat?

Quote:
File name too long
I'd look into how your storing your - repeated names repeatedly file names

Last edited by BW-userx; 05-10-2017 at 08:17 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
lftp copying folders charliehorse Linux - Software 1 03-31-2013 11:54 AM
Is it possible to remove all files & folders in a directory without using their names LAPIII Linux - Newbie 8 02-02-2012 04:18 PM
[SOLVED] How to changing same file names by their directory names? bayaraa_u Linux - General 3 04-09-2010 08:26 AM
copying folders with spaces between? flamesrock Linux - Software 3 03-13-2004 01:49 PM
Copying complete folders cipher_arg Linux - General 2 12-17-2002 05:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS

All times are GMT -5. The time now is 05:53 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration