General :: Copy One File To All Folders?

Apr 4, 2009

I am developing a Web-based application and have some folders that will generally reside outside of the Web accessible area of the server. However, since some people will not be able to store those folders outside of the "public_html" folder, I am looking to put a blank "index.php" inside of every folder within that section of the application. To make things easier, I would like to know if there might be a way to recursively copy one file into every folder in a certain location.

In other words, is there a command that might do something like:
Code:
> cp -R index.php /home/user/public_html/source-files/*
Basically, I want every directory inside of "source-files" to get a copy of "index.php". The directory hierarchy within "source-files" can go at least three or four levels deep, so the command would need to be recursive. I am looking for a command-line statement that I can type to perform this action.

View 3 Replies


ADVERTISEMENT

General :: Copy All Files Except From Some Certain Folders?

Jan 19, 2010

At the moment I'm using:"cp -ap . /destination-folder"to copy everything from the folder I'm in to another folder.That works.Is it possible to cp everything except:folder1/folder2/in the current folder I'm in?

View 2 Replies View Related

Ubuntu Networking :: Copy Files From XP Infact Folders Using TERMINAL In Netbook, Not Copy And Paste Using Mouse?

Jul 9, 2010

just installed ubuntu couple of days back on my netbook. I am still a beginner, enjoying my adventure exploring ubuntu. I have another desktop which runs on XP. I am able to access XP shared folders through my netbook(linux). However, i wanted to copy files from XP infact folders using TERMINAL in my netbook, not copy and paste using my mouse. Are there any commands for it?

View 1 Replies View Related

General :: Copy Symlinks To Target As Normal Folders?

Nov 30, 2010

i have a folder with symlinks:

marek@marek$ ls -al /usr/share/solr/
razem 36
drwxr-xr-x 5 root root 4096 2010-11-30 08:25 .

[code]....

i want to copy it to ~/solrTest but i want to copy files from symlink as well when i try to cp -r /usr/share/solr/ ~/solrTest i will have symlink here:

marek@marek$ ls -al ~/solrTest
razem 36
drwxr-xr-x 5 root root 4096 2010-11-30 08:25 .
drwxr-xr-x 358 root root 12288 2010-11-26 12:25 ..

[code]....

View 4 Replies View Related

General :: Copy All Files And Folders From Specific Date?

May 26, 2011

I wanna copy all folders and files created from 01.01.2011 until today to new placeie:cp -r /home/moviecar/public_html/wp-content/uploads/ /home/teaser/public_html/wp-content/uploads

View 4 Replies View Related

General :: Copy A Set Of Sub Folders From Their Multiple Parent Directories To A New Location

Nov 5, 2010

I am attempting to copy a set of sub folders from their multiple parent directories to a new location.

For example, I have three folders to copy:

I would like them to be copied to:

In actuality there are many folders besides folder1, folder2, folder3, and no numerical order exists. So, the folder named 'photos' would be copied to its parent folder's name in a new location. I would need this to occur for all folders in the '/home/user' directory.

View 6 Replies View Related

General :: Shell Script To Copy All Folders Older Than 7 Days?

Mar 16, 2011

I want to make the script to copy all folders which older than 7 days from Linux server to Windows server by Samba. And make it automatically by using cron

View 4 Replies View Related

General :: Copy Folders From Windows Machine To System Script?

Oct 7, 2010

I'm looking for a script to run that will be run from my linux box to copy folders from a windows server at a certain time on a daily basis.

View 2 Replies View Related

General :: Copy A Read-Only File And Make The Copy Writable With A Single Cp Command?

Mar 1, 2011

How to copy a Read-Only file in Linux and make the copy writable with a single cp command in Linux (Ubuntu 10.04)? The --no-preserve and --preserve seemed to be good candidates, except that they should "and" the mode flags, while what I am looking for is something that will "or" them (add +w mode).

More details: I have to import a repository from GIT to Perforce. I want that all Perforce depot files are Read-Only (that is how Perforce was designed), while all other files that were derived/copied from depot files are writable. Currently if a Makefile tries to copy a Read-Only file then the derived file will also be Read-only. This leads to build-errors when cp tries to overwrite Read-Only file second time. Of course the --force is a workaround here but then the derived file is also Read-Only. Also I do not want to mess with "chmod" after each "cp" command - I will do that only as the last resort.

View 1 Replies View Related

General :: Windows 7 - Backup Folders To External SFTP Server With Shadow Copy

Mar 1, 2010

I have an account in university on Linux machine with 10TB of free space accessible via SFTP. I would like to backup my Windows 7 x64 laptop to university. Currently I am using rsync+cygwin, but backup is pretty slow (without shadow copy) and I hate console window appearing every day on my screen when I login.

So I am looking for something like Windows Backup but with support for SFTP. Combination of tools will work too.

View 3 Replies View Related

General :: Find Folders With ONLY One Specific File In And Delete File And Folde

Oct 21, 2009

Many folders within a subdirectory some of which have lots of data in and some of which have only one specific file called produkt.fil inside.I need a command to find and delete those folders that contain ONLY the file produkt.fil - if other files exist (doesnt matter what they are) then they should be left alone. Note: produkt.fil exists in all of the folders always.

View 5 Replies View Related

General :: Copy Folder Hierarchy / Recreate All Folders From One Directory Without Copying Over Contents Of Folder?

Jul 2, 2010

Is there a way to recreate all the folders from one directory to another without copying over the contents of the folder? I've been trying to do something like this,

Code:for i in `ls $X`; do mkdir $PATH/$i; doneUnfortunately $i is deliminated by whitespaces in the filenames and not the actual folders.

$X contains only other folders so I dont have to worry about regular files but any kind of more "advanced" solution would work.

View 1 Replies View Related

General :: Copy Files And Folder Except Some Files And Folders?

Jun 8, 2010

I have many files and folders in my source folder. I want to copy some files and folders from that source folder to destination folder. What should be require to given with the "cp" command?

View 1 Replies View Related

General :: Copy Certain File Types Recursively While Maintaining File Structure On Destination?

Jun 14, 2011

I have just been bothered by a fairly small issue for some time now. I am trying to search (using find -name) for some .jpg files recursively. This is a Redhat environment with bash.

I get this job done though I need to copy ALL of them and put them in a separate folder BUT I also need to keep the order intact after copying.

For e.g - If I get a JPG file under /home/usr/new/1/ then the destination also needs to be /test/old/new/1/.

At the moment, I am simply putting all files under /test/old/ and I can't somehow get the later /new/1/ folder path created under /test/old/

I understand this could well be done using while OR if else loop, though if someone can just guide me with a hint, I would be really grateful.

I will complete the rest of the steps and was asking here since I am still not comfortable with the shell/bash scripts yet and planning to be really good at it over the next couple of months.

View 1 Replies View Related

General :: Copy File Whose Source Path Is Mentioned In File To Specified Destination

Jun 3, 2010

I had a situation in which the the path of the file to be copied is written in other file and I had to copy it using shell script..I can use cp $(cat /home/robert/location.txt) /media/sda1 on normal linux shell...But I am using buildroot script where $(cat /home/robert/location.txt) evaluate to nothing..is just blank..

View 1 Replies View Related

General :: When Copy File And Then Power Off / On Copied File Is Gone

Nov 16, 2010

I have an embedded linux system (Debian 'Lenny') which booting from a microSD flash. If I make a copy of a file on the flash file system (cp test test1) and then power off (disconnect power spontanious). Connects power again and the system come up, but the file test1 is gone. How can I secure that test1 is NOT disappear if the power get lost?If I copy file and then restart system with reboot command, the file test1 does not disappear.

View 7 Replies View Related

General :: Copy Some Text In One File And Paste It To Another File?

Sep 19, 2009

favor and let me know how can I copy some text in one file and paste it to another file ,when both of the files are being opened by vi text editor ?

View 7 Replies View Related

General :: Wrong File Permission / When Copy File

Oct 18, 2010

I have a C-function that create a file and then make a copy in the same directory, but somethin is wrong with permission or owners.The program starts as root user.The file creates by the program:

-rwxrwxrwx 1 root staff 199680 Oct 18 10:58 test

Ok, but after copying the permission is not the same.The file after copying (with new name) by the program:
-rw-r--r-- 1 root root 199680 Oct 18 10:58 test_copy

I want to have full permission of the copy, how to do??

View 2 Replies View Related

Ubuntu :: Copy Files/folders With GREP?

Jul 1, 2011

I'm attempting to find a particular word wherever it appears within a massive directory listing of teeny tiny text files -- and then copy all files containing this word into a "staging" directory.

Whenever I use the command below (on a test folder of smaller scale), it never carries the directory structure but attempts to copy all files within the "output" folder.

Code:
cp `grep -ir 'word' *` output

how to copy all these text files and have them retain some sort of directory structure?

View 2 Replies View Related

General :: Add Files/folders To A Tar File?

Aug 31, 2010

Is there a way to add files/folders to a tar file?

I am using the tar command for compression.

View 2 Replies View Related

OpenSUSE :: Copy Some Files And Folders To The Usb Memory Fails

Jul 29, 2010

when I try to copy some files and folders to the usb memory fails me. What if I copied it from console or dolphin. I get this console error:

cp -r /home/jonatan/Documentos/carpeta
cp: no se puede crear el directorio �./carpeta/ejemplo�: Argumento inv�lido

If I try to copy the data to an ntfs partition I have no problem.

View 5 Replies View Related

Programming :: Using Rsync To Copy Only Certain Folders Within A Directory Structure?

Jun 15, 2011

I am trying to create a simple bash script to rsync some folders within a directory stucture. I am using wild cards, in the rsync source directory structure, but my command always fails. I believe it is the way I am using wild cards within my for loop. Here is my command ;

Code:

for seq in `cat test.txt` ; do rsync -nvP /folder/folder/folder/folder/folder/**/$seq /folder/folder/folder/ ; done This always fails, where if I do a ls to the destination, to test the path, it always works.

View 5 Replies View Related

General :: Zipping Folders And Their Contents Into A .zip File?

Nov 23, 2010

How do I make a .zip file that contains every file AND every folder in the directory?

View 4 Replies View Related

Ubuntu :: Copy All The Pictures From Various Folders In Documents To A Single Folder

Dec 8, 2010

I'm using Ubuntu 10.10. I want to copy all the pictures from various folders in my Documents to a single folder. So in Nautilus, I clicked on Places > Search for Files. Then chose the Documents folder and typed *.jpg in the search criteria. It found all of my pictures just fine. However it would not let me copy and paste them into a folder I put on my desktop. Copy is not on the "right" click menu and Ctrl C did not work for the highlighted search results. This is so simple in Windows but it does not seem to work in Ubuntu.

View 4 Replies View Related

Programming :: Need To Copy The Obtained Output Files Inside Corresponding Folders?

Nov 2, 2010

I have encountered a problem:I have "while" loop; at each run a set of outputs is produced but then I need to shift them into a corresponding folder ; otherwise next run the new outputs will be over-written. Furthermore, I need to pipe what I have on the screen inside a file. I have put my code in the following:

Code:
# !/bin/bash
jf="GeoQuery.jar"

[code]...

View 3 Replies View Related

Ubuntu Servers :: Auto Copy Folders To Windows And Vice Versa?

Apr 6, 2010

1. I need a script(like a scheduled cron job) which should perform Automatic copy (backup) of a directory from ubuntu server to windows and vice versa....

i tried every thing like samba mounting,ftp,etc..with samba its possible to map the network drive of an ubuntu directory in windows..but if the ubuntu server is not available then i cant access the network share..

Exactly this situation is happening for me while backing up tmp directory of ubuntu server ...

so in this case i need a permanent backup of tmp directory of ubuntu server in windows rather than a network share.

2. Also any ideas or scripts regarding automatic ftp (while doing a backup) from ubuntu server to windows... which can easily solve the above issue...

View 8 Replies View Related

General :: Can't Copy A File

Oct 1, 2010

When i do cp filename destinationfolder it isn't happening. I don't get any error messages or any indication that the file copy didn't happen. But when I go to the destination folder and do ls; the file(s) not there. I tried it with sudo also and i get the same results. When I first did the copy it actually copied it somwhere but not where i wanted it. It copied it to folder name Desktop. So i tried copying it from Desktop and again same results.

View 3 Replies View Related

General :: Copy File Using SSH

Jun 23, 2010

I m trying to take backup of a file using ssh.I have written a command like following.Which will take backup of vm.cfg as backup.cfg...How would i modify my query?

View 2 Replies View Related

General :: K3b - How To Copy ISO File To DVD

Feb 26, 2011

I'm using ubuntu and I'm trying to copy a .iso file to a dvd. I have k3b at my disposal. My problem is that the dvd is not empty, and I'd like to overwrite it or wipe it before copying the new .iso, but k3b displays an error if I try to overwrite it, it says it doesn't have the necessary rights and proposes me to use k3bsetup. I have it too, but I don't know how to use it.

View 8 Replies View Related

General :: Best Way To Copy A Large File Over NFS?

Aug 24, 2011

I want to transfer a huge file (60GB) over the NFS network on linux. Is cp the best option?

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved