0
votes
1answer
30 views

(Windows Powershell) How to open a globally defined file with a certain application?

I've added the C:\Windows\System32\Drivers\etc\ directory, which contains the windows hosts-file, to my PATH environment. So if I start the shell at some arbitrary location (C:\ for example) and ...
1
vote
1answer
65 views

How to create destination directory structure dynamically when using mv with wildcards in bash?

I'm pretty new to BASH scripting and I'm looking for an elegant way to solve my task: In a given directory certain files regularly have to be sorted into subfolders. The name of the files has a fixed ...
2
votes
1answer
34 views

Hex of filesize

I am following a tutorial on few kernel dev. I encountered an operation where I have to use dd like dd ... if=PBL.bin of=... count=block_number The block_number variable is defined to be as The ...
1
vote
1answer
122 views

Move all files in sub-directories to current directory while renaming duplicates

I have a number of subdirectories and I would like to move any files contained therein to the current directory using a one line Terminal command on the Mac. I know that my file names are not all ...
7
votes
1answer
81 views

how to use dir and copy together to search directories and copy to a folder

I need to search a specified folder and its subdirectories for file(s), then copy them to a specified folder somewhere else. Is it possible to use dir and copy with a pipe? dir /s foo???.txt | copy ...
3
votes
2answers
101 views

How can I tell how long a particular file has been in a directory?

I want to find (and delete) all files from a directory that have been in the directory longer than X days. I know that I can find files that haven't been modified in an hour with find /directory/* ...
1
vote
1answer
1k views

Unix commands to get last modified date and size of file/folder (NOT LS)

I need a command that retrieves the last modified date and another that gives the size of a file. I've looked everywhere, and I cannot find commands like this. LS will not work.
0
votes
0answers
35 views

How can I un-concatenate a bunch of files?

I accidentally made a backup of folder using "copy folder folder_backup" and got a file called folder_backup. It contains all the bits of the folder. And I accidentally deleted the folder. How do I ...
1
vote
1answer
179 views

OSX / Unix: move odd or even numbered files

I have a folder with a range of numbered files (camera images) and I'd like to move every other image into a different folder, so either all the odd numbered images, or all the even ones. How can I do ...
1
vote
2answers
2k views

How do I actually open a program from a batch file? All it does is open a command prompt with that file name [duplicate]

I'm currently trying to learn Batch file scripting so maybe I'm just not seeing what I'm doing wrong but I am just making a very simple batch file that opens up a text file. Here is the code I am ...
0
votes
1answer
10k views

How to create a batch file that will run cmd and a exe with parameters

How to create a batch file that do following: For example program name is hi.exe will do the following: Run hi.exe in cmd with arguments hi.exe -f%l%. Instead of %1% I want user to input the ...
1
vote
1answer
262 views

Edit files from a batch script

How would I edit a file from a .bat file that changes the contents of a file located somewhere on the hard drive. For example there is a file on my desktop, can I make a .bat script that will add a ...
5
votes
1answer
735 views

Open file with default program from command line

If I click on a file in a GUI file explorer, a default program is used to open it. This is useful for files which I don't know how to open from the command line. Is there a way to open a file with ...
4
votes
2answers
72 views

How can I see which files are opened by a command?

I know lsof, which shows me the files opened by a running process, but if I launch a command, like calendar, that terminates immediately. How can I see what config files are read?
100
votes
18answers
6k views

What's the quickest way to count the number of each character in a file?

I want to count the A's T's C's G's N's and "-" characters in a file, or every letter if needed, is there a quick Unix command to do this?
3
votes
2answers
7k views

How to copy all files of a certain type into a folder from command prompt?

I want to copy all files of a certain type (like .docx, .pdf, etc) on my PC into a folder. How can I do that?
3
votes
1answer
180 views

Batch files: Outputting into txt file

I'm trying to output the dir c:/[x:x etc list into a text file as well with the following code DIR >"Input Data".txt The above works but it doesn't display exactly what is output onto command ...
2
votes
1answer
405 views

copy list of video file names to text file along with their runtime?

Copy list of file names to text file? I am linking the above page because of its relevance to my question. Is there anything similar that can be done to output a 'plain' looking text file (or xml or ...
2
votes
1answer
305 views

How to open a file from bash command line in the already open Emacs instead of a new instance?

How to open a file from bash command line in the already open Emacs instead of a new instance? When I type $ emacs file.txt it opens a new Emacs instance, instead of opening the file in the ...
1
vote
1answer
277 views

Concatenating many files into one

I currently have this command: copy /b *.txt newfile.txt But I want to include all files with folders as well. How can I do this? Is it possible to add this to Apache Ant as well? I also ...
0
votes
2answers
146 views

Recursive extracting of tree structure of included text file documents from command line?

I often find myself needing this: Say you have a test.c file; it includes other files, say: #include <stdio.h> #include "mylib.h" #include "../mylib_extra.h" #include "../mylib_bonus.h" ... ...
5
votes
4answers
9k views

How to remove “System File” attribute from a file without Command Prompt?

Is it possible to take away a file's system file attribute without using command prompt? Basically, I want to do this: attrib "folder" -s attrib "file" -s without using command prompt, or a batch ...
2
votes
2answers
1k views

How to delete file that has invalid name? [duplicate]

Possible Duplicate: Files with illegal filenames I've accidentally created -?.tgz file on my NTFS hdd (working under linux). And I'm just curious is it possible to delete it under Windows 7 ...
2
votes
1answer
175 views

What command sequence can I use to delete directories but not their files?

How do I delete directories but not the files inside them? I have tried the following: rm -di /Users/arthur/Desktop/MyFolder remove /Users/arthur/Desktop/MyFolder? y rm: ...
1
vote
1answer
734 views

split a large file with mac in command line by context

I have been trying to split a large file (some GB) into pieces, I need to chunk the file by linenumber (say, containings about 1M lines each). How could I do? csplit does not work, goes out of ...
5
votes
1answer
139 views

CMD does and doesn't see this file?

I'm having a lot of problems with a particular file, LockupSystem.MDB . It doesn't help that there are lots of files with similar names. I tried to dir to find the file but I couldn't find it. After ...
0
votes
3answers
193 views

Count all files without using find

How can I count all files without using find and only grep? I tried using ls recursively but how can I pipe that to grep and count files?
3
votes
2answers
1k views

Delete locked file/folder from command line

It is easy to delete file or folder from a command line or a locked file or folder from a nice GUI tool like Unlocker. However is there a way to delete locked file/folder from a command line? Is ...
12
votes
2answers
30k views

Windows: List files and their permissions (access) in command line

In linux, ls -l lists files permissions, like this: -rw-r--r-- 1 user user 924 2011-07-01 20:23 test.txt In Windows, commands tree and dir don't have the options to list permissions. How is ...
0
votes
1answer
95 views

How to remove files that start with 2011XXXX

I have a bunch of files i need to delete, they all start with 2011XXXX. How would i delete them. So far i have this command: ls | grep 2011 | xargs rm And it works, but is there a better way to ...
2
votes
4answers
2k views

Move all files in sub-directories to current directory?

I've got files in a bunch of subdirectories, and I'd like to flatten them out and move them all to the current directory. I found this question, but adapting the answer to: mv * . didn't work. I ...
3
votes
3answers
1k views

How to copy one file into multiple subfolders at once on a Linux server?

I have a folder on a Linux server with 35+ subdirectories, along the lines of: aa.foo.bar.baz ab.foo.bar.baz .. bp.foo.bar.baz I have a file that I want to copy into each of those subdirectories. ...
4
votes
1answer
6k views

Windows 7 command prompt: rename files located on a network path (UNC path)

In the command prompt, I need a way up rename a file on a remote server. Conceptually, this is what I am looking for: ren \\servername\folder\file.txt \\servername\folder\file2.txt Aside from using ...
11
votes
3answers
31k views

How do I delete directory trees via console on Windows 7?

I want to delete the whole content of a specified folder on Windows 7 via batch file. My problem is, that 'del' or 'erase' only deletes the files, not the folders and 'rmdir' or 'rd' Always deletes ...
0
votes
1answer
229 views

How to re-save web.config using command prompt

I'm using a simple cmd batch file to deploy my Asp.net MVC web application to server network share. The problem I'm having is that my DLLs can't be simply replaced by new files since existing ones ...
1
vote
2answers
4k views

attrib -s-r C:\<folder path>/d/s Just wont work?

I'm trying to change a file within a game I have installed on my computer, but the read only attribute won't change. I've researched this and found a way using the Command Prompt where I can change ...
0
votes
2answers
1k views

Inserting multiple files to mysql on command line

I am using ubuntu and mysql. I have a list of many .sql files, like 1.sql, 2.sql, 3.sql ... 100000.sql I need to insert them into the database mysql mydb < *.sql Gives me: -bash: ...
2
votes
2answers
2k views

How to prepend 8 bytes of data to a binary file in Linux?

I would like to add 8 bytes of data to the beginning of a binary file. Is there a Linux command for this?
4
votes
4answers
6k views

Bash command for full path to a file

I would like an easy way to get the full path to a file. I currently type this: echo `pwd`/file.ext Trying to shorten it, I made a bash alias: alias fp='echo `pwd`/' But now if I type "fp ...
36
votes
5answers
28k views

Recursively count all the files in a directory [duplicate]

Possible Duplicate: How can I count the number of folders in a drive using Linux? I have a really deep directory tree on my Linux box. I would like to count all of the files in that path, ...
6
votes
2answers
15k views

combine text files using command line script in Windows

Do you know somehow to achieve this in Windows? I am thinking about a few commands that will combine all the txt files in a directory into a single one.
0
votes
3answers
103 views

how to change ext of a file in Windows?

I downloaded a perl file from some webpage by opening it in my browser and saving it. But the saved file has a file name xxx.pl.txt. How can I save it into a file with pl as its ext? Also how to ...
1
vote
3answers
774 views

command line utility for changing file labels

is there a command line utility for changing the color label of files in macosx?
0
votes
2answers
1k views

If I receive files over the FTP command line, where will they be saved?

If I receive files over the FTP command line, where will they be saved?
45
votes
2answers
10k views

How to append to a file as sudo? [duplicate]

Possible Duplicate: sudo unable to write to /etc/profile I want to do: echo "something" >> /etc/config_file But, since only the root user has write permission to this file, I can't ...
0
votes
1answer
333 views

How to distinguish folders from files in a batch script? (Or how to copy & rename-timestamp them indiscriminately?)

I want to create a batch file to copy files or folders in a specified directory and append the date and time to their names. Here's my actual code: @echo off Set _bpath=T:\Backup\ if [%1]==[] goto ...
7
votes
5answers
2k views

A way to find newest files in a directory, including subdirectories

I'm looking for a way in Windows to list all files in a given directory and its subdirectories, sorted so that the newest files are on top. Is there any easy way to do this? I'd also settle for a Perl ...
0
votes
3answers
1k views

CMD Cannot find file, but it exists [closed]

I am trying to start an old DOS game (SimFarm) however it says that it cannot find the file. However the file is in the directory, and it exists. When I click on it, gives the same error. I tried ...
1
vote
3answers
386 views

locate/updatedb like tool (Linux CLI) for CDs/DVDs

I am looking for a Linux tool to search for files on offline media like CDs and DVDs. I know there are a lot of "cataloging" tools, but those are all graphical and I want a command line program. Ideal ...
1
vote
3answers
2k views

Modification of files with 777 permissions but not with 755 permissions?

I can modify the files with 777 permissions, but not with 755. I do it by sourcing some sed commands. I find it odd because I can modify the files with even 700 permissions in Vim. Why is it not ...