Can we scp the folders only


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Can we scp the folders only
# 1  
Old 02-27-2014
Can we scp the folders only

Hi,

I have a parent folder which has many subfolders and files. The subfolders also have many files.

I wish to scp the parent folder along with the sub folders but none of the files.

Is it possible ? Please let me know.
# 2  
Old 02-27-2014
scp is not a shell and can't really make decisions that way. scp doesn't really do recursion, either. Do you have shell access?
# 3  
Old 02-27-2014
Quote:
Originally Posted by Corona688
scp is not a shell and can't really make decisions that way. scp doesn't really do recursion, either. Do you have shell access?
yes, i hv access to "sh" on that unix box. Any workaround

Last edited by mohtashims; 02-27-2014 at 01:15 PM..
# 4  
Old 02-27-2014
Code:
find . -type d | ssh username@host 'cd /path/to/destination && while read folder ; do echo mkdir -p "$folder" ; done'

Remove the echo once you're sure its doing what you want.
This User Gave Thanks to Corona688 For This Post:
# 5  
Old 02-27-2014
scp uses ssh transport.
So you can use a combination of find, cpio (or tar), ssh.
For example
Code:
find dir -type d |
cpio -o |
ssh remotehost cpio -i -d

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to copy files/folders and show the files/folders?

Hi, So i know we use cp -r as a basic to copy folders/files. I would like this BUT i would like to show the output of the files being copied. With the amazing knowledge i have i have gone as far as this: 1) find source/* -exec cp -r {} target/ \; 2) for ObjectToBeCopied in `find... (6 Replies)
Discussion started by: Imre
6 Replies

2. UNIX for Dummies Questions & Answers

Archive folders and sub folders

Hi Can i archive folder and folders in with the tar command My files are located in subfolders Eg: Folder1/Folder1_1/*.pdf Folder1/Folder1_2/*.pdf Folder1/Folder1_3/*.pdf so i would like to tar all the files in Folder1_1 and Folder1_2 only not Folder1_3 that should be done next... (2 Replies)
Discussion started by: cnrj
2 Replies

3. Shell Programming and Scripting

Copy between two different folders containing same sub-folders

I have a folder like this ls input1 dir1 dir2 dir3 file1 file2 file3 dir1, dir2 and dir3 are sub-folders inside the folder input1 ls input2 dir1 dir2 dir3 file1 file2 file3 My dir1 in input1 folder has files f1, f2, f3 and f4. My dir1 in input2 folder has file f4 and f5. ... (3 Replies)
Discussion started by: jacobs.smith
3 Replies

4. UNIX for Dummies Questions & Answers

Searching for folders/parent folders not files.

Hello again, A little while back I got help with creating a command to search all directories and sub directories for files from daystart of day x. I'm wondering if there is a command that I've overlooked that may be able to search for / write folder names to an output file which ideally... (2 Replies)
Discussion started by: Aussiemick
2 Replies

5. Shell Programming and Scripting

Making 99 folders 99 folders deep

I am trying to make a unix shell script that will make 99 folders 99 deep (counting the first level folders). So far i have made it make the first 99 folders and 99 more in all of the folders. The only problem is the only way i have found is copying and pasting part of the script over and over and... (18 Replies)
Discussion started by: YukonAppleGeek
18 Replies

6. Shell Programming and Scripting

mv hidden folders

Hi guys! I need to know how I can move hidden folders because I have a script that backs up my svn projects everyday and I have 2 backup folders "Today" and "Yesterday". It is like this: Thanks a lot (2 Replies)
Discussion started by: ruben.rodrigues
2 Replies

7. UNIX for Dummies Questions & Answers

Sticky Folders

Hello everyone I've got a shell script that kicks off a number of django web sites. It allocates socket files in a sockets folder that the nginx uses to pass requests upstream. Problem is on my new ubuntu box, the script seems to run but the socket files that are created don't have the... (1 Reply)
Discussion started by: mjdavies
1 Replies

8. UNIX for Dummies Questions & Answers

Removing old folders

All Please help me to remove old files. For example /usr/exp/ - inside this Apr 02 - dir02 Apr 03 - dir03 Apr 04 - dir04 Apr 05 - dir05 Apr 06 - dir06 Apr 07 - dir07 Apr 03 - file03 I want to delete all the folders 2 days before created.Not the fil03 even though it is 2 days old. ... (1 Reply)
Discussion started by: DeepakXavier
1 Replies

9. UNIX for Dummies Questions & Answers

Copying Folders without some folders... ;-)

I am in a fix....... I have to write a backup script to backup say Folder A. Folder A contains n folders 1,2 ,3 .....n. my script should copy A without folder 2 & 3. Is there anyway I can do it without writing individual copy commands???? Please help.... (5 Replies)
Discussion started by: chimpu
5 Replies

10. Shell Programming and Scripting

Backing up Folders without some folders...;)

I am in a fix....... I have to write a backup script to backup say Folder A. Folder A contains n folders 1,2 ,3 .....n. my script should copy A without folder 2 & 3. Is there anyway I can do it without writing individual copy commands???? Please help.... (1 Reply)
Discussion started by: chimpu
1 Replies
Login or Register to Ask a Question