Friday, May 3, 2024
 Popular · Latest · Hot · Upcoming
4
rated 0 times [  4] [ 0]  / answers: 1 / hits: 26457  / 3 Years ago, tue, september 21, 2021, 8:26:06

This is my first time trying to work with Linux Scripts so this may be something obvious.



Here is what I am trying to do:




  1. Remove all contents from local folder - rm /home/user/Documents/Exercise/

  2. Copy files from a shared windows network drive - cp smb://server/arc/Exercise%20Files/Word/



So from my understanding my command should look like this



  rm /home/user/Documents/Exercise/
cp smb://server/arc/Exercise%20Files/Word/ /home/user/Documents/Exercise/


But anytime I try and run either of the above commands I get the following error:



  "rm: cannot remove `/home/user/Documents/Exercise/': Is a directory"
"cp: cannot stat `smb://server/arc/Exercise%20Files/Word/': No such file or directory"


What am I doing wrong?



Kind Regards,



M



EDIT:



I now have the rm function working yet am still troubled by the cp function. To ensure it is not an issue with the spaces in the folder names I have renamed the folders on the share so it now reads:
//server/Arc/ExerciseFiles/*



I have mounted the folder so I (assume) no longer need the smb://. It currently reads:
cp -rfv /home/user/Documents/ExerciseShare/ExerciseFiles/Word/ /home/user/Documents/Exercise/



M


More From » 12.10

 Answers
5

No your commands should look like following



  rm -rfv /home/user/Documents/Exercise/*


because folder Exercise can have subdirectories



and in case of a samba share first you have to mount it locally



i.e.



mount -t smbfs smb://"server/arc/Exercise Files/Word/" /mnt 


and then do



 cp /mnt /home/user/Documents/Exercise/

[#32201] Tuesday, September 21, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
looweets

Total Points: 52
Total Questions: 114
Total Answers: 111

Location: Turkmenistan
Member since Sat, Apr 16, 2022
2 Years ago
looweets questions
Fri, Apr 29, 22, 09:47, 2 Years ago
Thu, Nov 3, 22, 03:32, 2 Years ago
Sun, Mar 5, 23, 00:43, 1 Year ago
;