General :: Scripting - Move A List From A Text File To Directory ?
Jan 10, 2011
I'm sure I've done this before and am having a brain fart.
I have run into this a couple of time this last month:
I have a list of torrent files (blahblahhexblah.torrent) saved in a text file. I would like to read the text file and populate the client directory.
I can echo the file using:
But I cannot remember how to pipe the output into the directory, nor can I find any resources that describe the process.
Interestingly enough, I've had a couple of opportunities to do similar tasks with passwords and privileges and even across the LAN in the last few days. Solving this problem will help me solve the others for next time.
View 2 Replies
ADVERTISEMENT
Feb 16, 2011
I'm just starting out with shell-scripting, but having a problem with making new text files with the touch or cat > commands.
What I've been doing is touch testfile1.txt
Also, I've tried cat > testfile1.txt (text)
Console reports "bash: text1.txt: No such file or directory. Consfusingly, it works fine in the home-directory. But if I move the file to where I want it, I can no longer view, edit, etc. it.
View 1 Replies
View Related
Apr 18, 2011
Just using shell scripting, how can I insert text into the middle of a file name. The file has a predictable pattern, let's say 3 letters and 3 numbers and I want to insert text in the middle of those 2 patterns. Say ABC123 is the file name. As a result, the file name should be ABC.blah.123
View 2 Replies
View Related
May 2, 2011
I am working on some homework, however i am not here to be spoon fed. I am trying to get the numerical modification date of each file in a folder. Ie lets say there is a file called bob and it was modified 2006-11-23. i want to get it into a variable as 20061123.
Now i currently have this code:
Code:
However for some reason my output is:
Quote:
See how the 2011 has been placed next to it? i ran it with -x and saw this:
Code:
However i do not know how to find a way around this?
View 11 Replies
View Related
Feb 2, 2010
I have a directory , there are many files created in it , I want to use the command to move the files which elder than 30 days and gzip it and then move it to /tmp , and then remove those files , I tried use below command but not work.
find ~path -type f -mtime 30 -exec tar -zcvf - {} --remove-files > /tmp/oldfile.tgz ;
View 1 Replies
View Related
Dec 16, 2010
I have a text file with a long list of RPM's. I need to check if each RPM is installed. I'm sure I can cat out this file and run "rpm -qa" against it, but I'm having trouble with the syntax right now...
View 5 Replies
View Related
Feb 13, 2010
In order to protect myself if I make a mistake in typing a directory/filename path, I am searching for a way to prevent mv from doing anything if the source and destination files exist on separate partitions.I see no options in the man page.I just need to find a way to get the partition the directory/file is on
View 1 Replies
View Related
Jul 25, 2011
the system currently have a directory with all the invalid files. how bad is it to move a single file to a directory containing 3 million files already?
View 2 Replies
View Related
Jul 12, 2010
I am tying to write a script that asks for user input and saves it to a text file using awk so example #!/bin/bash read a awk #saves to file
I had a working scripted last night, deleted it by mistake and for the life of me can not remember how i did it.
View 2 Replies
View Related
Apr 12, 2010
I cannot move a my file into my archives directory in my bash scrip.
View 7 Replies
View Related
Apr 15, 2010
I've got a text file with a list of .gz files, these .gz files are in various sub directories of one parent directory and I've hacked this little script together to copy them from their current location to a new one and spit out any it can't find to "/home/user/not_found" but for the life of me can't get it to run properly!
The shell script as it currently looks:
Code:
View 4 Replies
View Related
Aug 11, 2009
Is there a way to process individual characters one-by-one from a text file in Bash, or is that hoping for a little too much from this lovable old clunker?
View 13 Replies
View Related
May 25, 2011
Our client has a website (Joomla 1.5 based) to promote participation in and report results of a 10k race for runners in Scandinavia...
The race is scheduled for late June and will be covered by at least 5 still photographers at various points along the race course.
There are to be about 5,000 runners, each entered under a shirt number like bib_1000 through bib_5999, and this means there will be a significant number of digital jpg files submitted by the photographers...
The client has in place some software which will "automagically" resize, watermark, and rename the individual files in the form:
And so on with a possibility of as many as 10 or 12 images in the aggregate with the same alpha-numeric "shirt number" at the beginning of the filename.
Our presentation software does a great job of handling thumbnail image generation and displaying a slideshow in a lightbox of all files within a given folder on the webserver.
And now finally the question...
Given a folder containing 25,000 or so *.jpg files, how can we write a script that:
1. parses the filenames to unique "shirt numbers"
2. makes folders with each "shirt number" as the foldername
3. moves the files from the root of the original folder into the appropriate "shirt number" folder.
Note that the order of my list above is not important, and if you know of a better way to organize the task we are fine with that.
View 12 Replies
View Related
Nov 8, 2010
I want to find maximum length file in a given directory. It should search recursivley. I want this to be done using ls and simple looping constructs.
View 6 Replies
View Related
Sep 7, 2010
I'm writing a script to execute bash commands in the PHP CLI. I would like to suppress errors from bash and write my own error message if an error occurs. So far I have this (assuming log.txt doesn't exist!):
Code:
tac log.txt 2>/dev/null
Which works as expected, tac kicks up an error but the error is suppressed, but when I use this:
Code:
tac < log.txt 2>/dev/null
I get:
Code:
bash: log.txt: No such file or directory
The tac error is suppressed but bash still gives me a dirty error.
View 2 Replies
View Related
Nov 29, 2010
Initially I thought - use a for loop with ls in it:
Code:
However this causes lots of problems (folders have extensions, I have duplicate folders, the names with spaces create a folder for each element of the name).
The contents of the folder is basically movies (some with subtitles). Some of the names have things like (original) or CD1 CD2 in them.
View 15 Replies
View Related
Nov 23, 2010
I don't know if this is a known issue, but when I want to copy/move a file to a folder containing lots of sub-folder displayed as list, I can't do a simple drag&drop, because there is no empty space to move this file. It will always go into one of the sub-folders. So obviously I have to go up one folder or to change view from list to Icon or Compact. Is it a known issue? Is there a solution? (Using GNOME nautilus 2.30.1)
View 9 Replies
View Related
Dec 21, 2010
I have a file with 5000 lines. it is a list of books authors, series and titles. all lines start with the author names, than there is a dash (-) than the series name, a dash again and the title of the book.
The problem I encounter is that sometime there is a series, sometime not, and as I try to enter this list in a database, I wanted to create a cvs file to import into mysql.
ex:
The best would be to be able to add in the second line, a "space dash space" just after the author name, but how to make sure it does not do it to the first line as well.
If I could separate all line with 2 dash, (grep ?) then I would be able to do a simple replace, and change the single dash into two.
View 2 Replies
View Related
Feb 8, 2010
How to list the contents of a folder to a text file. I'm trying to list all my music, including all subfolders, etc. to a text file, but I can't remember the command.
View 3 Replies
View Related
Feb 6, 2011
I'm wondering how it is possible to read each line from a text file, and then store each line separately in a list, using C++?
View 2 Replies
View Related
Aug 26, 2015
I work in a compagny and i encounter a problem with the samba trash.When i delete a file from our network directory, the file don't move to the samba trash directory. But, the server create the same samba tree like the orginal file. It's more simple with a example.This is the file i delete to my samba tree S:departementgestion_informatiqueinformatiquecommut est.txt.This is the samba tree that the server create at the moment when i delete my file : @IPcorbeilledepartementgestion_informatiqueinformatiquecommun
The problem is here : We want the file test.txt into this trash tree and it isn't.This is the Samba trash configuration :
# Samba Trash
#--------------------------------------------
# http://samba.org/samba/docs/man/Samba3-HOWTO/VFS.html
[code]....
The samba trash work for an another site of our company.
View 0 Replies
View Related
Apr 14, 2010
I'm running Ubuntu 9.10 and Gnome-Do 0.8.3.1. I have two issues I hope someone can help with.First I've managed to add two folders to the doc, however when I hover over the icon the name is displayed as "..." This might be because the path of the folder is "/home/eric/Desktop/500" which is a link to "/mnt/500" I cannot add the folder without the error listed below. When trying to add folders, and some applications I receive the error:
"Docky Error - Docky could not move the file to the requested Directory. check file name permissions and try again."
View 1 Replies
View Related
Nov 11, 2010
i want to move a directory to an external hard drive this is what i did
Code: konlah@konlah-laptop:~/Downloads$ sudo mv -i LinuxCBT /mnt/EXTERNAL after that i did
Code: konlah@konlah-laptop:~/Downloads$ ls so the file wasn't there anymore.. but i couldn't find it in my external hard drive.
View 1 Replies
View Related
Oct 7, 2010
We are running into issues with a File Upload script written in PHP. We can upload files without issues except with .*x files (such as .docx) We are getting permission denied errors. The error occurs when we use move upload file, to the new directory within our PHP app. If we give the uploads folder 777 access, it works fine without error. I dont like that. So I set it to 775 (Also dont like this), but it didnt work until I gave group ownership to www-data (I really dont like this)
This issue only happens on our production server, which is Ubuntu 9.04, running Apache2.2 and PHP5 will all the newest updates. We also have all MIME's configured, and are able to download the file from Apache without error. The first thing we noticed before the file permissions error, was that the MIME type changed to .zip when we used mime content type function. But yet using the FILES array, it still showed .docx.
View 2 Replies
View Related
Nov 2, 2010
I have run a command which finds a lot of files based on some search criteria. It returns the files like so:
./somepath/somepath/file.something
./asdf/asdf/s.php
./etc/a.php
./a/b/c/d/e/f/g.jpg
So I was wondering, if I capture this output into a file (ie. one file per line), can anyone help me write a command which iterates through the file and moves the files one by one to a specified directory?
View 3 Replies
View Related
Oct 10, 2010
i've been using some subliminal software on windows for a while now and have found it to be really good. It basically just flashes up a message on screen over the top of whatever is going on at that time but the message is only there for about 30 milli seconds
The message is not there long enough for your conscious mind to read it but the theory is that your subconscious mind will read it.It actually works really well. THe problem is that they dont package a linux version although they do have an OSX version, i'd really like this on ubuntu.
Tried it in wine and it installs but nothing happens after that. Alternatively perhaps somebody can tell me how you could get a message to flash up on screen based on a list of messages in a text file?
View 4 Replies
View Related
Feb 22, 2011
I need to get names of all installed packages in 2 machines and save them in 2 text files, then I want to compare these 2 files to know the differences between 2 files and from that I could know the differences between 2 machines. Is it possible to do that and what program I could use?
View 2 Replies
View Related
Mar 16, 2011
Im looking to use PHP to list a directory. When I click on a filename, I'd like it to automatically remove the first 16 characters off of the filename and save it to the filesystem.
View 6 Replies
View Related
Oct 14, 2009
I have a list of files in a directory which starts with - or have space.
I need to copy them back without the space or -?
linux1[sim]% ls linux1[sim]% cp ./-* ./*
View 8 Replies
View Related
Jun 28, 2010
When installing Ubuntu (10.04) I chose the /home to be installed in a separate partition.I would now like to move the /srv directory into the same partition. The problem I found is that Ubuntu did not make a /home directory inside the partition itself. It just places the account directories in the partition and mounts it to /home. So I cannot just easily move the /srv folder into the partition.
How can I:
Move those account directories into a home folder inside the partition Make that new home folder the default /home folder. ditto with the /srv folder, or any I choose in the future.
View 3 Replies
View Related