General :: Sorting Files In A Directory?
Jan 6, 2010I have some files in a directory like
file1.txt
file10.txt
file2.txt
[code]...
I have some files in a directory like
file1.txt
file10.txt
file2.txt
[code]...
I am dragging my files over to a new Fedora 12 installation and I just noticed that special characters are not taken into account when sorting files by name (I want '_js' to come before 'images').Is there a way to make the sorting process behave like Windows, where files starting with a special character are listed first?
View 5 Replies View RelatedI have a bunch of text logfiles in the following format:
ID (17 characters)
Timestamp (14 characters YYYYmmddHHMMSS e.g. "20060210100040" -> 2006/02/10 10:00:40)
Random data (? characters)
end of line
The files are already sorted by timestamp.I need to get 1 log file with all the logs from multiple logs files, sorted by timestamp. Note that the log files are really huge, around 3-4G each (and there are dozens of them) I tried the following command:
sort -s -m -t '|' -k1n,1n +17 -o data_sort.txt *.TXT
Here is how I ended up with this command:
-s : don't bother with tie results
-m : merge all logs files
-t '|' : there is no | in my logs, so the whole line should be field 1
[code]....
Actually... it fails miserably. The output file data_sort.txt is just the concatenation of all files, not sorted at all.
I download files onto my networked file server which is running Ubuntu 9.10.By default, all files are moved into the Downloads folder, I'd like to use a script or program to automatically send them into one of 5 shared folders based on what the file is.For example: archived files would be software by default, .avi or mpeg Videos, and .flac or .ogg would be Music.
View 1 Replies View RelatedI'm currently trying to organize a media server so that things will be in some kind of logical order rather than the current setup of dumping everything of a certain content type into a single folder. However, the size and diversity of content within these disorganized folders precludes me doing things manually. Does anyone know of a program or script that could sort the files into folders based on part of a filename
View 7 Replies View RelatedI often record music from the webradio with Streamtuner.How can I rename the mp3 files recorded in a way that numbers are added to the beginning of the filename representing the order in which the titles were played on the webradio station?I am looking for an automated solution like a renaming tool since there are usually hundreds of files in a directory. I used autorename / ARen for windows back in the day when I was still on XP. What I could do with the tool was:a) Sort the files by date of creationb) add an increasing number at the beginning of the filename based on the position in the sorted list.
View 3 Replies View RelatedSo I just had a quick question on logical volumes and such with ubuntu. I've been looking into setting up a storage array of 4 2tb hard drives for media storage in my house but have ran into a wall with with sort of array i should use, whether it be setting up a full raid system (raid 5 or 10 most likely) or using LVM for stripping. The one thing with LVM however, is that there is no parity or redundancy built into it in case 1 hard drive fails. I was wondering if it was possible to create something similar to that of LVM stripping, but instead the logical volume is sorted into whole individual files, not stripping them across the array. That way, if one drive fails, sure, i lose the contents of the one drive, but the rest of the content isn't lost and I have no loss of space because there is no inherent parity.
View 1 Replies View RelatedHow do you perform a long directory listing of all files in the /bin directory that have exactly three characters in their name?
View 1 Replies View RelatedIs there a way, on Linux, to cause all new files created in a directory to be owned by the directory's group instead of the creating user's group?
View 2 Replies View RelatedI want to run a cronjob every 15 minutes that checks a directory for files. If the directory contains more than ten files I want it to send an email to me.
All I have is this...
*/15 * * * * ls -l | wc -l | [filename] | mail -s "This is just a test" [email address]
I would rather not write a bash script. Is there an easier way to do this? I was looking into some commands like find and grep.
I'm quite new to linux but I have configured a simple ftp server and it's working great. I have a FTP-Shared folder with upload and download subfolders. Under upload's and download's I have identical category subfolders like mp3's, movies, software etc. in both. As the guy's upload, I would like to create a line crontab where I can move all the content under /FTP-Shared/upload/mp3/* older than 14 day's to FTP-Shared/downloads/mp3/ recursively (Like in cp command), but the timestamp must be searched on the first directory and not sub files example: /mp3/Club Dance/CD1/Hallo world.mp3This is how far I got:[root@clients ~]# /usr/bin/find /FTP_Shared/upload/Mp3s/ -depth -mindepth 1 -mtime +14 -type d -exec mv -f {} /FTP_Shared/download/Mp3s/ ;This command moves the directory and files, but it is not recursively
View 4 Replies View RelatedIf I have a directory /foo with a few files in it, how do I symlink each entry in /foo into /bar/? For instance, if /foo has the files a, b and c, I want to create three symlinks:
/bar/a -> /foo/a
/bar/b -> /foo/b
/bar/c -> /foo/c
How would i go about copying files to a directory, yet skip the files that already exist in the directory, and also remove the files that are in the directory. For example:
Code:
$ls /dir1
img001.jpg
img002.jpg
[code]....
Now i would like to copy from dir1 to dir2, but the contents of dir2 would be:
Code:
$ls /dir2
img003.jpg
I am trying to sort a file, so I can compare it to another file later. I am storing the file name in a variable called curMo. I then call sort $curMo and it hangs for a very long time and I have to quit the process. why this is not working or how to make it work?
Here is part of my code:
#sort this file for this Location
sort -u $curMo -o $curMo.sorted
I love using htop, but I have noticed that whenever I sort by a parameter (for example, Shift+m for sorting by Memory usage), the htop stats stop dynamically refreshing. Is this intended? I also notice this with top as well.
View 1 Replies View RelatedI have a file like:
ER- V67
ER+ V68
ER- V69
ER+ V70
[Code]....
I am using the code:
sort -k1
but it prints it by sorting the second column.
The command: Code: ls -lRt Shows a recusrive listing, and sorts by modification time. But this in in tree fashion, where it first lists the contents of the current folder sorted by time, and then the contents of each child folder sorted by time. How would one accomplish this type of sort, but with an aggregate listing - all items recursively sorted together, rather than by individual folder?
View 3 Replies View Related(1)There should be a command to send content to clipboard instead of 36 buffers available in vi just like ':set paste' allows pasting from clipboard inside vi using ctrl+shift+v in insert mode.(Currently I select area using mouse & right click then copy )
2)Let us say I have sentence "I am young" I want to arrange the words in this line in alphabetical order so that I get 'am I young'. First I thought replacing space by in sentence.Then !#j then type sort -n where # represents number of words.Then #J to join the filteredlines.It works but now I have file with hundreds of sentence of varying length.If I make a macro how will it know the number of words?
There are millions of files in many directories. Wherenver i try rm * or find or use xargs, they say 'argument list too long' and exit. How can i deleted files in a directory with so many files without deleting the directory itself.
View 3 Replies View RelatedI have a program that prints out lines like:
And I want to be able to pipe it to sort on that third column, by letter first, then number. But I keep coming getting files sorted like:
(field separations all start at same place, so columns are not jagged like above.)
I have read the sort man pages, and have tried -n for the numbers, and -k for the position to start sorting, among other things. I also tried inputting a second position to start sorting, which sort should supposedly refer to if the two entries are identical at the first place being compared, but it seems to just ignore the second one. I just can't get it to sort the numbers properly...
For now I am manually opening the file in emacs and changing them around, needless to say, very time consuming.
I am using my media server as my podcast collector. I am in the process of learning the ins and outs of NFS so i can mount a NFS directory and transfer my podcasts from server to player. For now i am using scp to transfer podcasts from server to desktop then to player. The problem is the path to the directory of one of the podcasts is /home/user/gpodder-downloads/The BILL&TIMMY Show Podcast.
whenever i try and run my scp command it fails because it thinks that TIMMY is a script i want to run in the background. I have tried to back-slash escape the character, i've tried single quoting and double quoting the character and i still get the same problem. as it sits now i have to move all podcasts to another directory and then transfer them to my desktop...but i would like to transfer the podcasts without un-necessary steps.
1. Given a string, row no. and col. no., I want to display it in the screen appropriately. how to do this?
2. How can I find the cpu processing time taken in carrying out the sorting task (any sorting program)?
Is it possible to copy files from directory of one user to directory of another user in linux?
View 7 Replies View RelatedI'm always hesitant to use /var/tmp/, because I never quite know exactly how long the files are kept there for, or even what the directory is used for. What determines when a file gets removed from /var/tmp/, and how is the directory intended to be used?
View 2 Replies View RelatedI have a USB drive that I boot using SysLinux. I think select one of several options to complete a task. I do not have access to edit those Kernels. I need to add a option from the Syslinux menu where I can delete all the files from a specific directory.
View 3 Replies View RelatedI'm writing a Perl script which performs linux commands.I have a directory with a load of files.
Code:exec_cmd('rm $(ls * | grep -v file1)');
This command will delete all except for file1. How can I modify this to delete all files except for file1 & file2?
I have four directories and i want to copy only the files in the directory to a single directory, how can i do it with the cp command.
The directories names are dir1, dir2, dir3 and dir4 and i want only the files from these directories to a single directory called mainDir.
So I am taking an half online/ half go to school class. I am working on an assignment that is due tonight by midnight. I am kind of confused on this question and am waiting on an email from my instructor but only have 2.5 hrs left til it's done. Here is the question.Use file globbing to copy all the files in the /labs/data directory that end with a .out to the lab07 directory. How many files are in the lab07 directory?when I ls -l into this directory. I don't see any files with that extension. Is there an easier way that I am missing such as. cp /labs/data *.out > lab07 ??? Someone help?
View 6 Replies View RelatedUsing tar command. All I need the usage, and basic explanation. Let's assume I have a directory with files that I need to tar, how do I go about it.
View 14 Replies View RelatedI have a php script in cron directory that generates 5 textfiles, after the files are generated, I want to create a script that will move the 5 text fiels to anoher folder name "web".
View 2 Replies View Related