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.
I'd like to copy a file, say widgets/water.txt, to all subfolders in the folder widgets using a single command. So if the folder widgets has 10 subfolders like widgets/blue, widgets/green, etc. I'd like to copy water.txt to all of them with one command.
I tried the commands
cp water.txt ./*/water.txt cp water.txt ./*/
However these don't seem to work. The latter gives 'cp: omitting directory' errors.
I would like copy a backup file from image vmware linux to windows but i don't know how to process it ?i tried :scp /source/backup.tar.gz firstname.lastname@example.org:/c:ProgrammefilesC:Documentsand SettingsAdminMyDocumentsbut error and i know that it's not like that, so if you have solutions
I am troubleshooting file copy time issues between 3 servers. I need to copy the same file from server A to both server B and server C and compare the elapsed times for the copy. Is there an easy way to do this?
-the command to copy the file Practice.txt to a new name of Myfile.txt while in the home directory-found -command to create a directory in the home directory-found -say i just created a new directory called "test". whats the command to delete the test directory.-found -command to create a blank, text file without using an editor. -the exact syntax in Linux you would need to rename the file to a new name-found
I started to copy a directory using Nautilus. I dragged and dropped a directory from my hosted server to my home drive. It got hung up, and wouldn't download. I clicked the red "stop operation" button, but I have a lingering icon in my upper panel saying that I still have file operations going on, even though it has supposedly stopped. How do I determine from the command line what this process is named and how do I kill it to remove the icon
I can't copy a few files from my pen drive. Got the files from a public computer, with windows. I use fedora 10.
cp gives the following error---> cp const1.java /home/user1/Documents/scjp cp: cannot open `const1.java' for reading: Permission denied lsattr shows this---> lsattr const1.java lsattr: Permission denied While reading flags on const1.java mount shows this---> /dev/sdc1 on /media/disk type fuseblk (rw,nosuid,nodev,allow_other,blksize=4096)
I am making the transition to either Ubuntu or Kubuntu in the next couple days. I have been running the Win7 evaluation version which is pretty much just Win7 Ultimate.Two are internal, four are external. All of them are NTFS. So are my pen drives (512MB and 8GB). Will these Linus distros be able to access these drives? If so, to what degree? Everything I have read online so far seems to give Linux a mixed track record when it comes to working around NTFS security, etc.
I run a sever 24/7/365 with Debian 5.0.4 (lenny) GNOME 2.22.3. It seems that the HDD is beginning to fail as it starting to clunk & you can hear it spinning up & down. I had lots of help in setting up the server, and i am not that good with linux...but i am learning all the time I have a spare HDD lying around, and i am wondering if its possible to use it to make a "exact working copy" of the HDD whats failing ? The spare HDD actually has XP on it, but i cannot see this preventing it from being used ?As my knowledge is still very little with Linux, and its important for me to replace the HDD, can anyone point me in the right direction to copying failing HDD ?? Also is it possible to then fit the new HDD into my server and it will work straight away ? This is to prevent any added downtime on my 24/7/365 server.
For example, if I type ':pwd' to get the current working directory, I can select the text in gvim but I can't figure out how to copy it to the clipboard. If I try the same in console vim, I can't even select it with the mouse. I would like this to work with all vim commands, such as set guifont to copy the guifont=Consolas:h10:cANSI output.
I have to transport a lot of files from one pc to another (both Linux). I would like to use scp for that, but scp only allows for transferring one file at a time. How can I do this?
I have No possibility to use rsync or any other protocol No possibility to use passphrase free certificates (but have a certificate with a passphrase) A list of files to transfer and a list with the destination path of the files on the other server The files are spread out over a lot of directories, and not all the files in the directories I want to copy If possible I would like to gzip and ungzip transparently to save bandwidth!
Imaging-copying a working remote share on WindowsNT to a local Linux disk target is needed . Is that possible with dd command(how if remote share is connected as smb://ipnumber/share) and do you need root privilleges on local and remote machine for that?Perhapson source machine:dd if=/dev/hda bs=16065b | netcat targethost-IP 1234on target machine:netcat -l -p 1234of=/dev/hdc bs=16065borrsh 192.168.xx.yy "dd if=/dev/sda ibs=4096 onv=notrunc,noerror" | dd of=/dev/sda obs=4096(any difference to dd/privilleges if you use it as windows dd version since remote is running windowsNT)?
I have a number of crash.log files scattered about my system and I would like to run a command to find all the crash.log files on the system and copy them to a single directory; each with a unique filename. For example, copy crash.log from ~/directory_1 , ~/directory_2 , ~/directory_3 and so on to ~/crash_logs/crash.log1 , ~/crash_logs/crash.log2 , ~/crash_logs/crash.log3 etc.
I just maked an ext4 partition by the help of gparted. Ubuntu is my only OS no dual boot. Using Ubuntu Maverick. The problem is partition must be open as root to do any work else it wont even allow me to open file,create folder,cut copy paste or anything.
I back up all my digital photos to a couple of places. I've been using the cp command, but--given the personal value--have started to wonder if there's a more reliable way. I'm no stranger to Linux, Bash, Perl, etc., so I could write something to copy and compare md5 hashes, but I was wondering if something already exists (reinvention, wheels and what-not).
Most of my googling for copy and (verify|valid|check|hash|confirm) turns up rsync. However, as far as I can tell, rsync only uses hashes to see if a file needs to be updated. It doesn't perform a hash comparison afterward. For this use, specifically, the files are binary and typically 8-10MB.
I am trying to upgrade PHP on our linux box ( CentOS ) I copied the configure command from the phpinfo and now I want to execute that.I am not able to copy the command from an editor in linux to the command prompt, clicking the wheel om my mouse does not work, neither does shift-insert or ctrl-shift-insert.It does work in the editor itself.Is there a way to do this ?Or is there a way to execute the command in linux while it is in the file ? Like a bat file on Windows ?
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.