filenames

MOSS Site Collection Documents - Restricting special characters in a filename

I am trying to block users from entering square brackets ([]) or other charcters to a filename while uploading a document. Is there a way to block this in SharePoint Central Administration or is there settings that I can change? ...

Working with htaccess files on Windows - actually save file as .htaccess?

When working with htaccess files on Windows, is it possible to save the file as .htaccess ? (Rather than having to rename on LAMP server) ...

Find long (>255) filenames

There are some folder with more than 100 files on it. But all files and folders names broken with wrong encoding names (UTF->ANSI). "C:\...\Госдача-Лечебни корпус\вертолетка\Госдача-Лечебни корпус\Госдача-Лечебни корпус\вертолетка\Госдача-Лечебн...

Dynamic filenames

So I'm working on a program where I store data into multiple .txt files. The naming convention I want to use is file"xx" where the Xs are numbers, so file00, file01, ... all the way up to file20, and I want the variables assigned to them to be fxx (f00, f01, ...). How would I access these files in Python using a for loop (or anther meth...

List image files using PHP -- and be case-sensitive

A drop-box directory for image files has collected variants by letter-case, for example: Bonsai.jpg, BONSAI.jpg, Bonsai.JPG, bonsai.jpg I am making a web app using CodeIgniter to manage these documents on a remote server. This means using file_exists() or is_file() to verify a file's presence HTML img tag to display the file grap...

Command-line arguments as bytes instead of strings in python3

Hello, I'm writing a python3 program, that gets the names of files to process from command-line arguments. I'm confused regarding what is the proper way to handle different encodings. I think I'd rather consider filenames as bytes and not strings, since that avoids the danger of using an incorrect encoding. Indeed, some of my file name...

Validating file paths

We want to validate file paths, e.g. foo/bar, which the user can enter. Is it possible to create files with leading or trailing space on OS X or Linux, e.g. foo/ bar /bazz? ...

rewrite URL to affect "save as" filename

Hi folks, My application is in JSP/Struts and running on WebSphere. I don't have access to the server /really/ so I'm trying to do all this from within the app itself (Struts actions & config, JSP, etc). I have a page that displays links for PDF documents that the user might want to look at. When they click on the link, it is forwarded...

Batch script to create folders based on filenames

I have a folder with a lot of PNG images that I want to create folders for based on their filenames. I would then want the files to be moved into their respective folders of the same name and renamed to 0000.png. Example: - abcd.png - efghi.png - jklm.png - nopqr.png - stuv.png - wxyz.png To: - abcd/0000.png - efghi/0000.png - jklm/...

How Can I Handle Parameters With Spaces in Delphi?

My program accepts input file names either as command line parameters or in a drag and drop operation or in Explorer by clicking on filenames with an extension that is associated with my program. The command line and drag and drop work fine, but it is clicking on the filenames in Explorer that causes problems when the filepaths of the ...

Why is fopen() behaving like this????

I am currently working on this project which requires me to make a function which dinamically decides the directory name and then creates a simple .txt file in that directory. my code is as follows: ($destinatario is a string) $diretorio="../messages/".$destinatario; if (is_dir($diretorio)) { ; }else{ mkdir($diretorio); } ...

How to change output filename if it originally is something else.

I have two files with different names. I have a for-loop to see if one file is there; if it is then it will change a file. My first thought was to make a list of all the files and what its counterpart is. That would not look nice and I can't cover all possibilities in the script. If this is the only way, how would I do it best? The scr...

bash scripting - selectively handle file names with spaces

I have a directory with the files names as "a b c.jpg", "d e f 0.jpg", "g h i.jpg" I need a script to have all the files ending with "0.jpg" to become "_0.jpg" So, in the above example the second file should become "d e f_0.jpg" ...

How do I ensure a file path is valid?

I'd like to ensure that a given file name is valid, even if it means replacing or removing some characters. I'm currently doing this: Path.GetInvalidFileNameChars ().ToList ().ForEach (x => path.Replace (x, '-')); But as far as I can tell, this is not guaranteed to yield a valid filename. Is there any better way than performing above ...

Change file name suffix(es) (using sed ?)

I'd like to change the file name suffix from files (using a bash script), but sometimes there are files with one period and some with two. Now I use this: new_file=`echo ${file} | sed 's/\(.*\.log.*\)'${suf}'/\1.'${num}'/'` Where 'new_file' is the new file name, 'file' the original file name, '${suf}' the file's suffix and ${num} a n...

In Python, how can I get the correctly-cased path for a file?

Windows uses case-insensitive file names, so I can open the same file with any of these: r"c:\windows\system32\desktop.ini" r"C:\WINdows\System32\DESKTOP.ini" r"C:\WiNdOwS\SyStEm32\DeSkToP.iNi" etc. Given any of these paths, how can I find the true case? I want them all to produce: r"C:\Windows\System32\desktop.ini" os.path.normc...

Simple user request for filename for output and input question

How can I request the user to input the filename that my program needs to read from and have it output the name with ".out" instead? Example: char fileName[256]; cout << "What is the file name that should be processed?"; cin >> fileName; inFile.open(fileName); outFile.open(fileName); But I need it to save the file as a filename.out ...

How do I retrieve all filenames in a directory?

How do I retrieve all filenames matching a pattern in a directory? I tried this but it returns the full path instead of the filename. Directory.GetFiles (path, "*.txt") Do I have to manually crop the directory path off of the result? It's easy but maybe there is an even simpler solution :) ...

What are the best characters to use for placeholders in file names (on Windows) AND URLs?

I am writing an application in C# that will need to find placeholders in URLs and/or file names, and substitute in a value, much like this: C:\files\file{number} => C:\files\file1 Unfortunately for that example, curly braces are allowed in file names and URLs. Can anyone please suggest some characters that I can use to denote placeholde...

From within a bash script, how do I create a new filename, place a $variable in part of it?

Within a loop in my bash script, I am 'doing work', then writing the result of each iteration to its own file. I'd like to name these files # User-defined Function (UDF) processLine(){ line="$@" # get all args index=$(echo $line | gawk -F::: '{ print $1 }') content=$(echo $line | gawk -F::: '{ print $2 }') # Let's tr it to remove do...