Programming :: Make A Folder For Each File In A Directory Then Move The File Into It
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
ADVERTISEMENT
Mar 28, 2011
I been using linux for a while, but I havent had the time to really learn it. Something Id like to get more familiar with is bash so here is a simple example of something I would like to do:
I have a directory full of files. For each file in the directory create a new subdirectory with each files name.
I tried this:
#im already in this directory
aaa=./*
for a in $aaa
do mkdir $a
done
One of the problems is that there are spaces () and - in the filenames so I get many subfolders with names like "-" which i don't want.
I tried stuff like:
aaa=./*
for a in $aaa
do mkdir "'"$a"'"
done
This of course also did not work.
Additional I tried just creating a folder with the name of one of the files and I got this:
mkdir: cannot create directory `(audio) - R56339.EXE': File exists
Well yeah a file exsists with that name, but I want to create a folder- why is there a conflict?
Just to be clear here are the contents of this folder:
~/Desktop/LAB/Media/Drivers - (Image Deployment)/Optiplex_GX260/XP> ls
(audio) - R56339.EXE (NIC-Onboard-Intel) - R54402.EXE
(Modem-datafax-V92) - R54403.EXE OEM_Applications
[Code].....
View 1 Replies
View Related
Dec 16, 2008
How can i make a variable in a bash script, to refer each file in a folder,and to switch it to the next file,until the last file of the folder?
View 2 Replies
View Related
Sep 14, 2010
When I position icons on the desktop in specific places, then I choose to move a file or folder into another folder, all the icons arrange back to the left side. This happened in an earlier version of KDE 4.x, disappeared the next version, and reappeared. how to keep this from happening. It makes using the desktop a pain in the you know what.
View 2 Replies
View Related
Feb 13, 2011
this is posable but am trying to do this "Create folder from a filename and move the file into the folder" i have 500000+ file's i need to do with is there a easy way?I really don't want to download them all make/move them with filemonkey just to re-upload them
View 2 Replies
View Related
Feb 8, 2011
i want to move the text of a file to another file,using sed command. how can i do it?
View 1 Replies
View Related
Jun 10, 2010
I'm currently stuck at 6.13 GMP-5.0.0 of the LFS installation. After running make, I receive the following:
error while loading shared libraries: libbfd-2.20.so: cannot open shared object file: No such file or directory
make[2]: *** [libmpn.la] Error 127
make[2]: Leaving directory `/sources/gmp-5.0.0/mpn'
[code]....
View 5 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
Apr 29, 2011
I am trying to post a driver in ..../cups/model folder but it says"access denied....could not write to ....cups/model.how do i move this driver file to the model folder
View 1 Replies
View Related
May 7, 2010
I wrote this little script and I need some help, I am trying to achieve following:Every day I receive new file in the /home/denis/MyData/ folder and I don't know what the file mane will be but I want to move any file that arrives there to the new location /media/DataBackup/Linux/backup/ (media/DataBackup/ is external 500GB USB drive)to automatically create new folder with the date and time stamp every day and then to move content of the /home/denis/MyData/ into the new folder with current date stamp. So every day there will be new folder and will contain files for that day only.My script is as follows:
cd /media/DataBackup/Linux/backup/
mkdir MyData_$(date +%Y%b%d_%HH%MM)
#this creates file MyData_current date and time
[code]...
View 3 Replies
View Related
Aug 6, 2010
I am running after compiling a program and I find that I get the following. How best can I avoid this as i cannot run the program. I have tried removing the offending package, although I cannot find it. I have also tried re-installing. I have also tried changing FC and F90 flags to avoid the MPI version.
error while loading shared libraries: libmpi_f90.so.0: cannot open shared object file: No such file or directory
View 1 Replies
View Related
Mar 23, 2010
I am able to view my windows network from my UBUNTU desktop after being prompted for a username and password to the windows network. No problem. But how can I accomplish this from the command prompt?
Here is my windows directory; smb://corpserver/d$/Data
And here is what I am trying to accomplish;
Code:
mv /var/lib/mysql/RSecuredData.csv smb://corpserver/d$/Data/Common/Secured%20R%20Reports/$(date +%Y%m%d)_RSecuredData.csv
Basically taking a csv file and moving it from mysql directory on my Ubuntu machine to a network folder on my windows server. (Windows Server 2003)
When I try that command from the command prompt I recieve;
Code:
mv: cannot move `/var/lib/mysql/RepoSecuredData.csv' to `smb://corpserver/d$/Data/Common/Secured%20Repo%20Reports/20100323_RepoSecuredData.csv': No such file or directory
View 9 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
Oct 3, 2010
Many years ago, I converted a portion of my files to an arbitrary format with a specific extension. i no longer desire to have them in this format and i would like begin the process of replacing them because conversion is not an appropriate solution. unfortunately, they are mixed in separate folders of the same root folder with files in my current format of a different extension. I feel it would make this process easier if I were to move every folder that contained a file with the undesired format to a separate root folder. The files are stored on a Linux server and shared via samba. How can I do this with a couple of commands or a script? I am open to other suggestions as well. I want to avoid time spent editing text files. Ultimately, I'd like a command that produced a list of full paths for folders, sorted by the number of levels would be a nice touch. A list of all of the files is clearly not what I'm looking for.
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
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
View Related
Apr 12, 2010
I cannot move a my file into my archives directory in my bash scrip.
View 7 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
Jul 2, 2010
When I hardcode abc.bin to inputFileName - I can open the file in cpp. But when I pass the same using an optional argument, it fails. Note that in both cases, fprintf, prints the inputFileName as abc.bin properly.
I get can't open - no file or directory.
Code: main()
{
char * inputFileName;
char * optarg;
inputFileName = optarg; //doesn't work.
[Code].....
View 2 Replies
View Related
Apr 17, 2011
I'm trying to move a file in C, but I guess there is a simple method to do this in libc!
Somebody knows how can I do this on libc, or using some "default" method?
View 9 Replies
View Related
Jun 4, 2010
Is there a valid way, or trick to move the EOF indicator of a file? For example the file contains the data:
Code:
I am asking question.
0123456789
This is the example content of the file.
End is after the period.
I want to move the EOF after the number 9 so that when I read the file it will now contain:
Code:
I am asking question.
0123456789
Is this possible? Language to use is C.
View 4 Replies
View Related
Jun 4, 2011
I need to create a folder for every single file in a directory, possibly making the folder have the same name as the file that it will be containing. Is it possible to do via terminal?
View 9 Replies
View Related
Apr 23, 2011
I've got a bash script I'm using to download a text file list of links via axel. What I'd like to do is automate the movement of completed links in the for loop when axel has successfully completed the download. This is what I've got. I can figure that I can just echo append the line to a new file, but what is the easiest way to delete the line with the link I just downloaded?
Code:
#!/bin/bash
for i in $( cat $1); do
axel --alternate --num-connections=6 $i
export RC=$?
[code]....
View 14 Replies
View Related
Oct 13, 2009
I am trying to add a command to my backup script to delete the oldest file in the destination folder before adding a new .tar.gz file.I found this information at .html which I thought would work fine and added the following line to my backup script:ls -t -r -l /backups/Scalix_Backup* | head --lines 1 | xargs rmHowever when I tried this I get an error:rm: invalid option -- wTry `rm --help' for more information
View 7 Replies
View Related
Feb 6, 2010
I'm using ubuntu 9.10. I was wondering if it is possible to make a file/directory transparent when it is 'cut', like it is in Windows.
View 14 Replies
View Related
Mar 7, 2011
It's a few days now that I notice everytime I save a page in Firefox, only the .html file is saves, and firefox does not make a folder associated with the page in which it saves the images, etc..Could this be because I installed TOR and the TORBUTTON for firefox?I have, however disabled the TORBUTTON addon from Firefox, and restarted the browserbut the problem persists.
View 2 Replies
View Related
Sep 26, 2010
I have a pipe delimited flat file, field 27 is price. I would like to move items marked sold to a new file every couple months.
awk -F"|" '$27 == "SOLD" {print $0}' awktest2.data >> awkout2.data
Allows me to write line to new file but I need to delete the original line, I also want to make sold case insensitive tried [Ss][Oo] with no luck
View 4 Replies
View Related