Ubuntu :: Return A List Of Files Without The Extensions?
Jan 3, 2011
I am writing a bash shell script and I am trying to use a select case to modify a few files with the same filename but different extensions (i.e. problem.tex problem.log problem .pdf etc.)
It goes something like this:
Select item in $list
do
compile $item.tex
open $item.pdf
delete $item.log
break
done
exit
Right now my list is list=$( find . -maxdepth 1 -name "*.tex" ) which returns a list only from the current directory of all files ending in .tex so when I try to open the resulting .pdf file I get the error:
error: file problem.tex.pdf doesn't exist
So I'm trying to find a way to use just the name in a select menu.
I have a directory of a load of files without extensions. I know what the filetype should be, so is there any way of batch renaming the files to append a given extension onto it. i.e. text would be renamed as text.txt?
I going through the Python course on Codeacademy. I have some trouble understanding what I'm doing wrong. This is my code below:
Code: Select alldef count(sequence, item):   total = 0   for x in sequence:     return x     if x in sequence:       total += 1   return total print count([1,2,1,1], 1 )
The code gives me an error: "Oops, try again. Your function fails on count([1],7). It returns 1 when it should return 0."
It should be outputting 3 because 1 occurs 3 times in the list.
I have some directories with a varying numbers of files and subdirectories. All files that have no extensions have to be tared. Their names may change, thus they can not be hardcoded. Subdirectories may also contain a unspecified number of files and subdirectories that are not relevant and should not be included in the archive.
I'd like to be able to do this with a single line, not using any .sh scripts, so that this process could be reproduced as portably as possible.
Sample directory structure:
$ ls -1F bar-dir/ bar.with.dots foo-directory/ foo-no-ext
I'm wondering how I'd be able to symlink all the files in a dir structure and then also copy files of a certain extension in that dir. I'm basically symlinking all files within /foo/a,b,c to /bar/a,b,c and then copying over certain files with a certain extensions.
I'm trying to convert all file extensions for files in many sub-directories from uppercase to lowercase. I have two problems, how to list the absolute path to the files recursively over many sub-directories for which I so far have this:-
Code: find ~/Photos -print which would be fine, except it gives the directories on their own when it finds them rather than just the files with absolute paths. I couldn't find a switch for the "ls" command to do this, so I had to improvise with "find". and once I get grab each absolute file name, to just change the file extension rather than the entire file, which is what I have at the moment.
I am trying to get this script to work. The purpose is to download a list of modules from the slax.org the list consist of a list of module numbers. What I am trying to do is Download the file or the file name corresponding to the number in the list.the list is comma delimited. this is what I have done so far and I am a stand still.
#!/bin/sh # Wget script to retrieve modules from slax.org modules # # ----Begin of user defined values ----- # Path to wget
I am trying to write a bash script that will extract a .cbr (.rar) file, traverse the extracted files in alphabetical order and rename them 001.JPG, 002.JPG, 003.JPG, etc.So far I only have this much to extract it:
I have scoured the 'ls' man page, but I don't think it has the capability to do this. Specifically, I would like a command/program that will output a list of all of the files in "/home/anthony/Music/" in the following format:
whether the command-line tool "mysql" comes with mysql-server or mysql-client (I installed both at once, so I have no idea). It occurs to me that this is a good opportunity to learn more about linux package management.
I've tried saying "dpkg -L mysql-server", but it only lists the files in /usr/share/docs files for some reason. I'm sure there's got to be files elsewhere. Am I way off base?
have installed some programs from source and found no trace where and what were installed and I would like to remove those installed files. So I am looking for any script or app to list all orphaned (I mean not related to any installed package) files. I am using Ubuntu Server 9.10 without any fancy X11 stuff so console version is preferred. I have found bitbleach and computer janitor in this forum but they are X11 apps.
I've having problems in listing files from a TAPE. I did not create this tape and I'm assuming that the files were successfully backed up to this tape.Some commands that I've tried:
I'm looking for a terminal command that gives me the latest created folder in a directory tree.
Code:
ls -lR --sort=time --reverse
this i almost good, but a) it gives me files (rather than folders only), b) it sorts the files by folder (rather than just giving me a plain list of everything) and c) it takes way to long.
Is there a way I can list all open files by a user? I found the command lsof but it the command lists too many files some of which are not used directly by the user. What I want is to view only the files that are currently open like text files, documents, pictures etc and not other system files.
if there is an application available to generate a list with files and folders from a location, like a hard drive or a folder? The list could be in any format, even a text file would be just fine.
I have some files located in /vol0/archives that has several files Eg:- arch_00001.arc , arch_00002.arc, arch_00003.arcI want to tar each of those files into separate tar ball by taking it garbing it file name sequence,Eg:- arch_00001.arc.tar.gz , arch_00002.arc.tar.gz, arch_00003.arc tar.gzhow do I define the tar command to go get those files and tar each file separately, As I mention above
How to list only today modify files in Linux ? How to 'scp' the today updated or modified files to another server? How to list files with modified date in Linux ? Currently am using UBUNTU 10.04
I'm writing a bash script to copy a list of files and do some stuff to them. Basically, I have the code written that does what it needs to do, but I can't quite understand why it works. I was hoping someone could clear up my understanding a bit.
Code:
The first line generates a list of files. I wrap each line in quotes because they usually have spaces in the directory names.
The second line changes IFS, and I understand what IFS itself does. What I don't quite get is what the separator becomes with that echo statement. If I'm reading that correctly, the backspace will remove the newline and essentially the result is nothing? I found this solution on a web page somewhere, but it was years old and there was no real explanation.
I'm about to do a migration on a laptop where I have had to make a number of modifications to files mainly in /etc/ but I have lost track of what I have done. Does anyone have any suggestions as to how to identify those files that have been modified from their packaged versions?
I have been searching but can't find a list of files/packages on the Squeeze 'testing' DVDs/CDs. I remember running across some posts with that info a while back but can't seem to find them again.
how to make a list of all mp3 ogg or any other files in linux and save it as csv. Or, do somebody know a program or python script which allow you to do that by just pointing at the location with this files??
How can I see the list of files - e.g. patched files - of a delta RPM file ? I can convert the drpm file into a cpio archive with rpm2cpio tool but cpio -i produces a Malformed number along with scrambled characters in the output.