filenames

Problem checking the name of a file in php

I am writing a PHP page to convert an uploaded file to XML. I only want to convert the news file to XML. The only file that ever needs to be converted is news.htm. I have narrowed my problem down to this if statement. What is wrong with it? $fileName = basename( $_FILES['uploaded']['name'] ); if( strcmp( $fileName, "news.htm") == 0 ) (...

MonoDevelop 2.2 beta 2 "No File Name Provided" When Launching in External Console

When I try to run my Mono C# programs in MonoDevelop on an external console, I get the following error. http://i146.photobucket.com/albums/r248/bobber205/error.jpg (First time needing to post a pic here on stackoverflow, sorry if this isn't correct to just post a link) :) It runs on windows's regular "cmd" console when I debug with in...

Generate unique file name with timestamp in batch script

In my .bat file I want to generate a unique name for files/directories based on date-time. e.g. Build-2009-10-29-10-59-00 The problem is that %TIME% won't do because it contains characters that are illegal in filename (e.g. ':'). Is there something like 'tr' in batch files? Any other ideas how to solve this (that don't require extr...

Short file name question?

Im trying to add some short file names to a Wise installer to fix validation errors, which is simple for the most part. However if I have the following two files: LongFile1.dll LongFile1.EN.dll Should these be: LongFi~1.dll and LongFi~2.dll ? Or do I have to do anything special becuase of the .EN.dll? ...

Deleting smaller sized dupes of files

I'm trying to locate files with the same name and delete all of the smaller sized copies, leaving only the largest. For example: test.jpg = 2kb, test.jpg=9kb, test.jpg=5kb. The 2kb and 5kb files would get deleted, leaving just the 9kb. I've tried a couple of GUI programs to do this and they were no help, as you had to delete everything m...

Regex for file names, with no url?

How can I write a regex which will replace any file name, with it's folder path, but wouldn't match url? and wouldn't match in url? For example it should match: /images/something.png content/scripts/myscript.js image.gif /1.jpg But should not match: http://www.google.com/images/something.png www.google.com/scripts/myscript.js http://...

Colon/Asterisk as a filename delimiter?

I'm looking for a character to use a filename delimiter (I'm storing multiple filenames in a plaintext string). Windows seems not to allow :, ?, *, <, >, ", |, / and \ in filenames. Obviously, \ and / can't be used, since they mean something within a path. Is there any reason why any of those others shouldn't be used? I'm just thinking t...

Automatically finding numbering patterns in filenames

Hi all, Intro I work in a facility where we have microscopes. These guys can be asked to generate 4D movies of a sample: they take e.g. 10 pictures at different Z position, then wait a certain amount of time (next timepoint) and take 10 slices again. They can be asked to save a file for each slice, and they use an explicit naming pat...

Get the longest non-glob string at the start of a string

I'm trying to create a script to convert from $GIT_DIR/info/exclude to .gitignore files. I'd like to put the .gitignore files as close to the pattern target as possible, meaning that a glob like /a/b/*/*.c should be put in /a/b/.gitignore. To do this accurately, I need something which can return the longest substring from the start which...

Get All current file names in directory and write it out in console C#

I'm writing a program that requires the ability to list all applications installed, and it will do that by listing all the uninstallers for it in a specific directory. This code isn't working, and the directory is created and there are files in the directory if (startarg.Contains("-il") == true) { //Lists all...

With a utf8-encoded Perl script, can it open a filename encoded as GB2312?

I'm not talking about reading in the file content in utf-8 or non-utf-8 encoding and stuff. It's about file names. Usually I save my Perl script in the system default encoding, "GB2312" in my case and I won't have any file open problems. But for processing purposes, I'm now having some Perl script files saved in utf-8 encoding. The probl...

With php cURL get filename from file header

Hello, I have this php cURL function: function curl_login($url,$data,$proxy,$proxystatus){ $fp = fopen("cookietlt.txt", "w"); fclose($fp); $login = curl_init(); curl_setopt($login, CURLOPT_COOKIEJAR, "cookie.txt"); curl_setopt($login, CURLOPT_COOKIEFILE, "cookie.txt"); curl_setopt($login, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MS...

What is the right way to compare two filenames to see if they are the same file?

So I have two Windows filenames I need to compare to determine if they are the same. One the user gave me, one given to me by another program. So how should you compare: C:\Program Files\Application1\APP.EXE C:\Progra~1\Applic~1\APP.EXE C:\program files\applic~1\app.exe I can't seem to find a way to consistently 'normalize' the pat...

Get names of all files from a folder with Ruby

I want to get all file names from a folder using Ruby. ...

How to display abbreviated path names in .NET

I have a fixed-length field I'd like to display path information in. I thought in .NET there is a method that will abbreviate long path names to fit in fixed length fields by inserting ellipsis, for example "......\myfile.txt". I can't for the life of me find this method. ...

Bash: For Filename do......

Hi I'm not used to do things in Bash, so I'm having some problems: My goal is to look for special files in a folder, and if found generate some other files with the same filenames, but different extension. Something like: For Files-that-are-called-"SysBackup*.Now" do NewFileName = ChangeFileExt(FoundFilename),BK GenerateNewfile(N...

Git - change case of a file on windows?

There are a couple of files in our git-controlled codebase that I'd like to rename. Specifically, I just want to change the case of the file, so that sourceCode.java becomes SourceCode.java, for example. The catch: I'm on a Windows box, and the filesystem thinks those are the same file name. How can I get Windows and git to recognize ...

Append date to filename in linux

I want add the date next to a filename ("somefile.txt"). For example: somefile_25-11-2009.txt or somefile_25Nov2009.txt or anything to that effect Maybe a script will do or some command in the terminal window. I'm using Linux(Ubuntu). Thanks in advance. oh i almost forgot to add that the script or command should update the filename to...

Automake pattern expansion

I'd like to include many files in one Makefile.am file in the xxx_SOURCES = ... part. Is there any way to use a typical shell expansions there? What I'm looking for is a working equivalent for: xxx_SOURCES = xxx.c $(top_builddir)/src/{aaa,bbb,ccc}.c ...

Linux - Replacing spaces in the file names

I have a number of files in a folder, i want to replace every space character in all file names with under scores. How can I achieve this? ...