filenames

Meaningful Method Name

Hi all, I'm writing a method which calculates a user's phone recharge credit expires within n months. I couldn't think of a meaningful name. At the moment, it is called getCreditExpiresInNMths(); What would you name it? Hope you don't think it is a silly question, I think a good method name is important. :) Sarah ...

Create a C++ container that contain the filenames within a directory

I need to generate a container of filenames within a directory in C++ and it must be cross platform compatible. Someone recommended using the WIN32_FIND_DATA data structure. Is this the best option and if so how would I implement it? The user will not enter the filenames, but rather the C++ function will automatically search the directo...

How to get a list of files that match some pattern?

How to get a list of files that match some pattern if filenames may contain \n character? Update: I want solution in pure vimscript, so that it will depend on nothing but vim. Update2: Expected output of glob function Consider the following script: :!touch /test ; mkdir /test$'\n' ; touch /test$'\n'/test :echo glob('/**/test') /test...

Bash script -e not detecting filename in a variable

In a BASH script, I'm trying to detect whether a file exists. The filename is in a variable but the -e command seems to be unable to detect the file. The following code always outputs "~/misc/tasks/drupal_backup.sh does not exist" filename="~/misc/tasks/drupal_backup.sh" if [ -e "$filename" ]; then echo "$filename exists" else ech...

Filename completion in vim with xterm doesn't work as expected

Something funny is going on with my vim. I'm using it through xterm. I want to be able to autocomplete filenames that I try to open. For example: # Cursor is | character :o exam| :o exam|<TAB> :o examplefile.txt| I was sure vim supported this, but it's not working for me. When I hit <TAB> an ^I character is inserted instead of comple...

Matching filenames with id

I have 1 text file which contains numbers from 1 to 11644. Beside the numbers are the names of the xml files that i have in another folder. I have a total of 8466 xml files. I need to match the filename of all the xml files with the id in the text file and extract the value of the id out. All of the id are in random position. An example ...

Displaying a links absolute location...

Is there any way I can display a links location absolutely when I only reference it relatively. I.e. A file is relatively referenced like... <a href='../../files/uploaded_file.jpg'>Your Uploaded File</a> But I would also like to display some text saying... You can link to your file via www.example.com/files/uploaded_file.jpg The c...

Сonvert unicode (UTF-8) filenames to ANSI (DOS)

Directory listing with broken filenames encoding C:\Downloads\1>dir 18.01.2010 10:45 <DIR> РЎР?Р>Р?Р?С?Р+ 18.01.2010 10:45 <DIR> Р?Р?С'Р?Р>Р?Рє 18.01.2010 10:45 <DIR> Р"Р?С?Р?Р°С╪Р°-Р>РчС╪РчР+Р?Рё РєР?С?РїС?С? 18.01.2010 10:45 <DIR> Р•Р>Р•Р?РўР Р?Р?Р? Is there any tools for windows t...

filename encoding on server

Hi Folks, another encoding question. On my server, I want to have the possibility of having mp3-files with utf-encoded filenames, for exampe Начало.mp3 . Now when I save (or rename via my FTP client) a file to Начало.mp3, after refreshing, this file will automatically be renamed to ??????.mp3. I added a htaccess to both the parent an...

grep command working in my testdir but not in the "real" directory why`?

I just thought I had found my solution because the command works in my test directory. grep -H -e 'author="[^"].*' *.xml | cut -d: -f1 | xargs -I '{}' mv {} mydir/. But using the command in the non-test-direcory the command did not work: This is the error message: grep: unknown option -- O Usage: grep [OPTION]... PATTERN [FILE]... ...

Ant mapper: Changing file name using a property

I have a ant property app.prod= production During the an build, I want to replace all files in a particular directory with production in its name to same nma e without 'production' in it. Example File names are abcproduction.xls cdeproduction.xls I want to remove change the file names to abc.xls cde.xls <regexpmapper from="(.*)$...

Delimiter for meta data in Windows file name

I'm working on maintenance of an application that transfers a file to another system and uses a structured filename to include meta data including a language code. The current app uses a two character language code and a dash/hyphen for a delimiter. Ex. Canada-EN-ProdName-ProdCode.txt I'm converting it to use IETF language code and so...

finding a number in filename using regex

I don't have much experience with regexes and I wanted to rectify that. I decided to build an application that takes a directory name, scans all files (that all have a increasing serial number but differ subtly in their filenames. Example : episode01.mp4, episode_02.mp4, episod03.mp4, episode04.rmvb etc.) The application should scan the...

Renaming a Word document and saving its filename with its first 10 letters

I have recovered some Word documents from a corrupted hard drive using a piece of software called photorec. The problem is that the documents' names can't be recovered; they are all renamed by a sequence of numbers. There are over 2000 documents to sort through and I was wondering if I could rename them using some automated process. Is ...

Bat: how to extract filenames of a command

Hi I am trying to create a script listing the names of the files return by a program. The program is called ShowFiles.exe and it takes to arguments like this: "ShowFiles opened ..." so argument 1 is "opened" and argument 2 is "..." The the result looks like this: c:\tmp\test1.txt#0 - add default c:\tmp\test2.TXT#1 - edit defa...

List All Files in a Directory using Dot Net Zip?

Is there anyway in Dot Net Zip that I can use to list all the names of files in a specific directory? For example, i can specify Directory1 and get File3 and File4 etc ZipFile ------- File1 File2 Directory1 File3 File4 Directory2 File5 File6 ZipFile object has only Entries, Entries Sorted, and Entries File Names.....

PHP - filename calls function on different script, get filename from script containing function

fileA.php: requires function.inc.php and uses x() from that include file fileB.php: requires fileA.php User invokes fileB.php to get fileA.php function.inc.php: function x() - returns filename that invoked it What is the PHP server variable or whatever that gets the name of fileA.php from within function.inc.php? Usecase - function ...

How to handle undecodable filenames in Python?

I'd really like to have my Python application deal exclusively with Unicode strings internally. This has been going well for me lately, but I've run into an issue with handling paths. The POSIX API for filesystems isn't Unicode, so it's possible (and actually somewhat common) for files to have "undecodable" names: filenames that aren't e...

Recursively remove filename suffix from files in shell

When we develop locally, we append ".dev" or ".prod" to files that should be made available only to the development/production server respectively. What I would like to do is; after deploying the site to the server, recursively find all files with the ".dev" suffix (for example) and remove it (renaming the file). How would I go about do...

Change filename by 1 every time (bash script)

I'm making a (bash) script for mass keyfile generation. I need the script to name the first generated keyfile "1", the next "2" and so on - So I need every filename to be the previous filename + 1. The script so far: #!/bin/bash #Files in directory dir=$(ls -U -l /home/user/keyfiles|wc -l) name= #script target=/home/user/keyfiles/$na...