Programming :: Copying Multiple AVI Files To NAS Server
May 18, 2009
I am working with DM355 target board. Here we record. The video coming from IP cameras. Now I have to write c program for copying. The recorded avi files with date and time to NAS server using scp. I wrote a script to copy single file to NAS server.
I have 60+ directory's each containing multiple .doc files. I need to move them to a single directory and keep their file name intact. I don't think cp will do that with out listing all the file names. I was thinking of something like: cp -r /dir/*.doc /newdir . Or should I use a combo like find -type *.doc|cp /newdir?
Suppose I have a tree structure like this: /home/mahmood/sim/a/b/file1.cpp /home/mahmood/sim/a/b/file2.h /home/mahmood/sim/a/c/file3.txt /home/mahmood/sim/d/file4.txt
How can I copy all of them to /home/mahmood/sim. So that when I run "ls" in /home/mahmood/sim, I see all files: file1.cpp file2.h file3.txt file4.txt
Can 'cp' search for all file and copy them in another folder?
Description: I am a newly appointed system engineer taking care of linux servers. We have a new set of data coming in which need below configuration: How to do a script with function?:
for files with ".txt" in sm copy each of the files to folder : sm1 and sm2 (log every copy) if succesful: remove original log into the log file if not successful: (not successful copying 1 particular file to all the folders) retain and retry log into the log file mail out the admin with that particular file name
I have already do try a bit: cd /export/home/ for dir in sm1 sm2; do cp -p sm/*.txt $dir/ done Is my starting right? How to do the rest parts?
I have a server with RedHat distro which stores and updates someg files and second computer with Windows 7 on it. I must configure both machines so one can get those files from server to Win7 machine using ssh. But I have no idea how to do it.
I'm trying to copy files from my current server to a new server. Both servers have SSH installed. These are the commands I'm using. However I'm getting connection refused. I did a google search and found out that maybe the reason of this error could be due to the fact that my current server doesn't have SSH. However I use SSH often on my current server so I can say that it has SSH for sure.
OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008 debug1: Reading configuration data /etc/ssh/ssh_config debug1: Applying options for * debug1: Connecting to IP_OF_CURSERVER [IP_OF_CURSERVER] port 22. debug1: connect to address IP_OF_CURSERVER port 22: Connection refused ssh: connect to host IP_OF_CURSERVER port 22: Connection refused
I need to copy a large number of files, it comes to 1 lakh from one server to another. When I tried various commands using scp , ftp etc. It is saying "Arg list too long". In which way can we copy all the files. The Two servers are under Linux.
i would like to copy all files from my server001 (/var/www/vhosts/*/httpdocs/) to my server002 (/var/www/virtual/*/htdocs/) i would do it via rsync... but i dont want to do it as root! what would be the right user with which I should login myself via rsync? www-data? its the group of each domain-folder...
Quote:
server002:/var/www/virtual# ls -lh insgesamt 4,0K drwxrwx--- 10 vu2001 www-data 4,0K 9. Mär 09:58 domain.com server002:/var/www/virtual#
but the files inside htdocs are only accessable for the user!
Code:
server002:/var/www/virtual/domain.com/htdocs# ls -lh | grep index.php -rwxr-xr-x 1 vu2001 vu2001 397 24. Feb 23:30 index.php server002:/var/www/virtual/domain.com/htdocs# server002 will be the backup-server if the server001 is down!
I have a problem while copying files from a remote computer to my local one using the scp command. I am sure that I am using it correctly, please check it below: --- blah@blah.com:~/g4work> scp blah2@blah2.com:IndirectMethod_Spher...s/H_1.mac.root . --- What I get in return (instead of the statement saying 100% of file copied) is: --- On this machine the G4SYSTEM=Linux-g++ ---
The interesting point is that the above returned statement is one of the Environment variables set on both the machines that are necessary to work with a toolkit called Geant4. Here is what I get when I type 'printenv | grep G4' just to show you (note the statement in bold): --- G4LEVELGAMMADATA=/home/blah/geant4/geant4.9.3.p02/data/PhotonEvaporation2.0 G4INSTALL=/home/blah/geant4/geant4.9.3.p02 G4LEDATA=/home/blah/geant4/geant4.9.3.p02/data/G4EMLOW6.9 G4NEUTRONHPDATA=/home/blah/geant4/geant4.9.3.p02/data/G4NDL3.13 G4VIS_BUILD_OPENGLX_DRIVER=1 G4RADIOACTIVEDATA=/home/blah/geant4/geant4.9.3.p02/data/RadioactiveDecay3.2 G4ABLADATA=/home/blah/geant4/geant4.9.3.p02/data/G4ABLA3.0 G4LIB=/home/blah/geant4/geant4.9.3.p02/lib G4VIS_BUILD_RAYTRACERX_DRIVER=1 G4LIB_BUILD_SHARED=1 G4VIS_USE_OPENGLX=1 G4UI_USE_TCSH=1 G4VIS_USE_RAYTRACERX=1 G4REALSURFACEDATA=/home/blah/geant4/geant4.9.3.p02/data/RealSurface1.0 G4SYSTEM=Linux-g++ G4WORKDIR=/home/blah/g4work --- The other thing that I would like to mention is that these Geant4 Env. Variables are loaded each time a new (bash) shell is started as a result of the bash login script.
I use a mencoder line to convert .avi to .mpg (dvd player compatible), it works well but i can only do one file at the time. It requires giving the input and output directories and the files name. I tried using (*.avi *.mpg in the command) on the directory but it just add up all the .avi and convert them into one huge .mpg. My goal is to have a script that would convert all the .avi files from a directory to the same amount of .mpg and also keep the naming of those files. Here is what i work with on single files:
I feel kind of embarrassed posting here, but this is technically a scripting sub-forum. Here is the problem. I have a folder with various files which include .txt files as well
How can i redirect same content to each of the .txt files in the folder?
I have tried Code: $ echo "hello" > *.txt -bash: !": event not found Code: also cat ~/otherdir/test.txt > *.txt -bash: *.txt: ambiguous redirect Can anyone help me with this?Ok i solved it Code: #! /bin/bash for file in *.txt do echo "Text that needs to be written" > $file done
I use grep <pattern> abc.* to read the files. But here grep read files in the order of 1,2,3,4 . I want to to grep the files in reverse order like 1st the abc.4 file will be read and abc.1 file will be last.
how i could compile for example: a tutorial file of cantera open source files. when i do :g++ example.cpp -o examplei get huge errors such as the header files are not here,...please tell me how i could compile it. ofcourse i have configured the full opensources and i see in /usr/local/cantera/binthat the files are there but i still can not compile and execute any cpp file.
My query is i have a.sql , b.sql , c.sql files which needs to be executed using "$ db2 -tvf a.sql"; "$ db2 -tvf b.sql"; "$db2 -tvf c.sql" , script with which i can execute all these sql files in a single shot.
I have a folder which includes bunch of folders each having data files in them. [ Folder A has F1, F2 F3 ..... F1000 folders in it, and F1, F2, F3 ... each has about 10 different files named FILE 1, FILE2, FILE3 .... in them.
I am interested in File 1 of each Folder, because that contains the data I need in it. More specifically, that File1 s have a line "ANSWER=..." in them, and i need to get that value of the ANSWER from each file. So doing it by hand is so hard, so I need to write a script that will scan all folders and give me a list of values of eache ANSWERs.
I am looking for the quickest way to do multiple searches for different files.Here is the scenario: I want to search for various icons one by one in a script. Preference is for the gnome icon theme.
The echo piped into grep part seems to take a long time. Is there a quicker way of doing this?I do not want to use slocate, sqlite or the like since that will require admin privileges to update the database and/or extra dependencies.
I have written FORTRAN code to calculate density profile. This code will open two files ( topology and x,y,z trajectory). The trajectory file contains XYZ data coordinates for multiple frames (about 20 or 100 frames for instance). One frame contains 20736 data.
Previously this code was written to open ONLY one input XYZ data file and do the calculation and would dump the results in separate file and it was running without problem. Recently my data file get bigger in size, so I decided to break the single XYZ data file into few small parts.
Now I have modified the code so that it calls the parts of the XYZ data files ( eg: maltoTHERMO_10Frames.traj, maltoTHERMO_20Frames.traj,... and so on) and do the calculation and dump the results in the same result output file. I have tested this code just with openning the XYZ coordinates and printing into another file to see wheather it collecting the data sequently and it was working fine.
This code supposedly read the x coordinate data and calculate distance and put a count accoding the criteria in the approperiate bins. But when I let the code to do the calculation it stop and shows error. (I have indicated as !** in the code). If I enable this line, it shows error but if I disable this line, than the code do collect only the XYZ coordinates.
compiling and linking using gcc: What does a file name with a suffix '.a' represent? If I have multiple .c and .h files, how can I link them together? How can I create the .a file?
I want to change some HTML in my files (80+ so I prefer not to do this by hand). I got a script to replace a string in files, however the HTML I want to replace contains an enter (and tab of 4 spaces) (explanation below) Does someone know how I could update my HTML by using a function in Linux?
I also found sed but don't know how to use it with the enter (linenumbers will not work because they variate)...
I'm trying to change a group of cpp files to one shared lib. I have created a shared lib with a single file. I then did this with a group of files. The difference in what I'm doing is that before with the single file, .a, was added into a single .o file. Now I'm trying to add it to my main.cpp file which is NOT a .o file. I'm now getting these compiler errors from the main.cpp where is doesn't seem to recognize the semaphores.Example Error: undefined reference to `sem_wait'If I were not to use the share libs this compiles and runs as I expected it to.Something tells me this is a compiler flag issue, at least I hope it is
I've been hitting my head against a wall for awhile with this one:As the last part of some data analysis I performing I would to construct a matrix from a series of different files. These files have the format:
I have wrote a 1 line command that parses a file, locates the IP Address in the file and then trims the output the way I want it, and then sorts numerically and by uniqueness and then >> appends to output.txt
I can get all the IP's into 1 file "output.txt", but what I am really looking for is some type of way to create a text file, for each IP it finds labeled xxx.xxx.xxx.xxx.txt and also put that ip address into that file..
I've been trying to sort this out for several hours and I?m totally lost? I?ve been searching around, but haven?t found the solution to my problem. I have a directory with 100 files. I need to copy 10 lines of each files (let?s say from line 45 to 55) into one unique file. So I guess I could use sed ?w, but I didn?t manage to write the right script. I also tried using a loop to create 100 different files, each one with the 10 lines) to concatenate them later on. But I only got 1 file, not 100.
bash script to give sensible names to a large number of photos. I hope to be able to run a script with an argument which will become the filename followed by a number beginning at 1.
I'm playing around with a bash script to pass files to a program (such as VLC). I thought something like this would work:
vlc $( ls | sed 's/ /\ /g' | tr ' ' ' ' )
ls shows the files in the current directory, then sed changes spaces to " " (to escape them) and finally tr removes the line breaks. I end up changing:
01 - Music Track.mp3 02 - Another Track.mp3 to
01 - Music Track.mp3 02 - Another Track.mp3
"vlc 01 - Music Track.mp3 02 - Another Track.mp3" works if I type it manually but my script reports a problem with `-'
I have this cool bash script that I worked hard on. But it broke down when it can across files that had non-English characters. Another small problem was getting it to descend into a directory. If it renamed a directory it would not descend into that dir to rename the other files. I would have to run the script twice on the same directory.
Here is the script: Code: find -type d -o -regextype egrep -iregex '(.*.ogg|.*.mp3|.*.wav)' | while read s do rename -v 'y/A-Z/a-z/' "$s" done find -type d -o -regextype egrep -iregex '(.*.ogg|.*.mp3|.*.wav)' | while read n do rename -v 's/ /_/g' "$n" done A French name like this:
Code: Chateau De Sable (imagine accents above the letter a) became this:
Code: ch303242tea_de_sable This is not what I wanted.
Why would the script not descend into a directory after it was renamed?