FAQ Database Discussion Community

## Why PHP cant find long filenames?

php,filenames
inside a Folder i have a file, named 111-aaaaaa aa aaaa-,._aaaaaaa; aaaaaaaa, aa aaaaaaaaaa, aaaaaaaaa aaaaaaaa. 03.01.10. 38.38 aaaaa.txt when i browse that directory with PHP (or trying to read that file): var_dump(glob('MyFolder/*'));exit; it cant find that file. what's problem?? (if i shorten the filename, then it becomes findable..I am...

## Bash filename autocompletion after switch/parameter

bash,autocomplete,filenames
I tried this other questions's accepted answer but it doesn't work for me. So please don't vote this as duplicate. My script is named "tracker" and it accepts the following switches: --dummy --audit_sessiones --user_count --detailed_user_count --parfile The --parfile switcj should be followed by a filename. I have this autocompletion script:...

## Remove-Item with “.” in filenames doesn't work

powershell,filenames
My Powershell Script checks if a file exits. When it exist, the existing file is deleted. Then a new file with same name is saved. It works perfect when no dots (".") are in my filename (and path). I thought -LiteralPath would be the solution, but it doesn't work, don't...

## Manipulating temporary file paths

r,filenames,filepath,tempdir
I have a list of files on different temporary paths in tempdir(). The paths are given here, where /tmp/Rtmp9pF0OF is my tempdir() for my R session. [1] "/tmp/Rtmp9pF0OF/4fc42cb004a7160951778110/0" "/tmp/Rtmp9pF0OF/4fc42cb004a7160951778110/1" [3] "/tmp/Rtmp9pF0OF/4fc42cb004a7160951778110/2" "/tmp/Rtmp9pF0OF/4fc42cb004a7160951778110/3" [5] "/tmp/Rtmp9pF0OF/4fc42cb004a7160951778110/4" "/tmp/Rtmp9pF0OF/4fc42cb004a7160951778110/5" [7] "/tmp/Rtmp9pF0OF/4fc42cb004a7160951778110/6" "/tmp/Rtmp9pF0OF/4fc42cb004a7160951778110/7" [9]...

## pathnames in Common Lisp, filenames with wildcards in them

common-lisp,filenames,wildcard,clisp,pathname
The characters * and ? are used as wildcards in pathnames. How does one refer to a filename that has ? as one of its actual characters? For example: [18]> (wild-pathname-p #p"foo") NIL [19]> (wild-pathname-p #p"foo?") T So referring to the filename "foo?" cannot be done this way. I tried...

## BASH find file names but skip a list of file names

bash,printf,sh,filenames
I'm trying to set up a process in BASH from the "find" output. However I also have a list of file names that should not be process but they are in the same directory. I can't differentiate the files by file type. An example is the following: m001.png m002.jpg m003.tif...

## Automating filename generation from url text

python,filenames,python-requests
I am parsing some content from the web and then saving it to a file. So far I manually create the filename. Here's my code: import requests url = "http://rads.stackoverflow.com/amzn/click/1593271840" html = requests.get(url).text.encode('utf-8') with open("html_output_test.html", "wb") as file: file.write(html) How could I automate the process of creating and saving the...

## Copy certain files from one folder to another using python

python,file,csv,filenames
I am trying to copy only certain files from one folder to another. The filenames are in a attribute table of a shapefile. I am successful upto writing the filenames into a .csv file and list the column containing the list of the filenames to be transferred. I am stuck...

## Android replaces certain characters in the filename with ASCII hex value

android,filenames
I'm creating files in my app with '{' and '}' in the filename (e.g. {foo}.xml). However, the special characters are being replaced with the ASCII hex values instead (i.e. {foo}.xml is created as %7Bfoo%7D.xml). Any thoughts on how to get around this and have it actually create '{foo}.xml' ?

## PHP - Find File in Directory By File Name [closed]

php,select,directory,filenames
I have a directory full of filenames that contain unix timestamps. file_1434320602.data file_1434320352.data file_1434320112.data file_1434320032.data How would I get about loading them up in PHP so that I can select the one which I needed?...

## from x(defined in program) import y(defined in program) python

python,python-2.7,import,filenames
I need some assitance since I really have no idea how I can fix this: x="test" y="test2" When I try to import y from x , it says that there is no file with the name "x" (from x import y) Is there any way to import test2 from test...

## How to Combine Two paths?

c#,xml,path,filenames
I have an XmlTextReader to read series of XML files to load some information in to my program. However, in some XML files I have the file name of an image and I want to load that image. But the problem is the XML file does not have the full...

## VB6 get filename from path

csv,path,vb6,filenames
In my VB6 code I have the statement Open CommonDialog.FileName For Input As #intFileNum The problem is that CommonDialog.FileName returns an entire path and VB6 Open command needs just a filename. For example if the path is C:\temp\file_name.csv then CommonDialog.FileName will return C:\temp\file_name.csv but this Open statement in VB6 will...

## space containing items in bash for-loop

bash,for-loop,whitespace,filenames,filepath

## Log4net rolling filenames [duplicate]

c#,log4net,filenames
This question already has an answer here: log4net rolling file appender file name format when maximumFileSize reached 1 answer I'm using log4net in a C# application <log4net> <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender"> <file value="..\logs\Program.log.xml" /> <appendToFile value="true" /> <rollingStyle value="Size" /> <maxSizeRollBackups value="10" /> <maximumFileSize value="10000KB" /> <staticLogFileName value="true" /> <layout...

## writing to variable filename

c++,filenames,fstream,ofstream
I want to write to different files with names give by variable r. Following is what I wrote. The proble here is, it is just opening the first file 'r=0.5.txt' and writing on it the data for r=0.5. However, it does not open and write on other files with r=0.6,...

## Read filename with * shell bash

linux,bash,shell,variables,filenames
I'am new in Linux and I want to write a bash script that can read in a file name of a directory that starts with LED + some numbers.(Ex.: LED5.5.002) In that directory there is only one file that will starts with LED. The problem is that this file will...

## Tail command - follow by name on Solaris

filenames,solaris,file-descriptor,tail
Is there a way to tail a file by name on Solaris 10? Equivalent to: tail --follow=name Manual for tail on solaris shows no such option. Only -f is included and it looks like it follows a file by descriptor....

## How to capture a photo and immediately put it into an existing pdf?

android,filenames,image-capture
I couldn't find the solution for my issue. My MainActivity creates a pdf file, the user adds some text via EditText and closes it, no problem with that. Then I have a secondary activity that is calling the MediaStore.ACTION_IMAGE_CAPTURE to take pictures. Once a picture is taken, I'd like to...

## how to replace special characters in file names [closed]

powershell,batch-file,replace,filenames
We are in the process of moving to OneDrive for Business. To store files in OneDrive you can't have the following charactes in the filename: /:*?"<>|#% Additionally, a file name that begins with a tilde (~) isn't supported. I would like to search and replace the special character with a...

## Copy file1 name inplace of file2 and add extra to it, but not copy file1 extention

java,file,copy,filenames,rename
How can i change the name of a file to match the original file and have extra txt in it, please see example below Original dataFile.txt thisNameNeedsToMatchDataFile.txt (but also have ".Step2" added in before the .txt) Desired output dataFile.txt dataFile.Step2.txt Any help would be appropriated thank you in advanced....

## Issue creating .txt file with long name

python,filenames
I am trying to create a series of text files with reasonably long names (but nowhere near 260 characters). An example file name is: Premier_League-Tottenham v Manchester City-Saturday, Aug 14 2010-12:45-0-0-410996-Home-Team-2010-2011-30-2015-06-14.txt The code I am using to generate this looks like: mylogprint = "Premier_League" + '-' + str(the_home_name) + '...

## How do I escape spaces in a path with Applescript?

path,escaping,applescript,filenames,space
I've written a script so I can quickly get a link to files and folders on my server. The problem is that the string I get does not escape spaces. Can someone tell me how to escape the spaces for '%20' ? tell application "Finder" set sel to (the POSIX...

## awk to manipulate multiple files

awk,output,line,filenames
I have the following files file1 and file2 (as example) $cat file1.txt SERVICE: 1 TASK: 1 RESULT: 1 ADDITIONAL: 1 SERVICE: 2 TASK: 2 RESULT: 2 ADDITIONAL: 2 SERVICE: 3 TASK: 3 RESULT: 3 ADDITIONAL: 3$cat file2.txt SERVICE: 1 TASK: 1 RESULT: 1 ADDITIONAL: 1 SERVICE: 2 TASK: 2...

## How to read files in C# in a directory whose names contain a specific word? [closed]

c#,directory,filenames
I have a directory on my C: drive called practice. I have txt files there with these names: CityUpdated, TownUpdated, MetroNotUpdated, SuburbNotUpdated. I want to write some C# code that reads the text files whose names contain the word "Updated". But I can't figure out how to do this using...

## Python- creating a text file with a variable as a name

python,text-files,filenames
So im doing a project where my program creates a textfile named "Ten Green Bottles" and writes the 10 green bottles song in it, I have successfully got it working but i want to make it better. I started by making the amount of bottles optional to the user and...

## AppleSctipt Finding File with partial filename

get,applescript,filenames
I am an applescript noob and i need help getting a certain log file that has a long string of numbers in its title. The number changes and the filename before the number string is unique to the folder it is in. Is there some way i can use the...

## python compare and replace strings in txt file with filenames

python,list,replace,compare,filenames
I have a file data.txt and a sounds folder with mp3 music files. data.txt contains a list of filenames.mp3 (in random order) from the sounds folder and from other folders. I've converted the mp3 files in the sounds folder to wav, and I want to replace the filenames.mp3 in the...

## In PHP, find an existing file using a regex pattern for the file name

php,regex,filenames
I'm aware of the glob function. However, I am needing to match a regex pattern. Say I have the following directory of files: /assets |- logo-abd6d458.png |- logo-big-bd7543cd.png |- another-ab87dbf0.css +- something-784b52ac.png I need a PHP function that should return a filename of an existing file in this directory when...

## VBA Save As Current Filename +01

vba,excel-vba,iteration,filenames,save-as
I'm looking to write a macro to save my current version filename +1 instance of the version. For each new day the version would reset to v01. Ex. Current = DailySheet_20150221v01; Save As = DailySheet_20150221v02; Next Day = DailySheet_20150222v01 While increasing the version number, I am hoping the version won't...

## Python, pygame - Loading image filename from string variable in a list?

python,string,list,pygame,filenames
I'm a beginning pygamer trying to upgrade a text game I wrote to a gui game. animals = {dog: "Dog" 4 "Bone", cat: "Cat" 4 "Yarn", parrot: "Parrot" 2 "Bell"} pet = animals[dog].split() pet.append(pygame.image.load('//home/me/Desktop/Python/'+pet[0]+'.png') If I were to input the above code and try to run it I get: pygame.error:...

## std::cin working for small number of lines, but not larger ones

c++,list,import,filenames,cin
I'm writing a part of a program that takes a list of filenames provided by the user and stores them in a vector. So far, testing with small numbers of filenames (I've done up to 11) works fine and the program continues, but trying to import 70 or more filenames...

## Find digits in file names and cross reference them with others

c++,regex,string,filenames
First, I will quickly describe my motivation for this and the actual problem: I deal with large batches of files constantly and more specifically, I find myself having to rename them according to the following rule: They may all contain words and digits, but only one set of digits is...

## Filename from string(path) without file exist

c#,string,filenames
I am trying to get a file name out of a string, but it is possible the file does not exist (yet) when trying to get the file name. So as far as i know, i can not use the Path.GetFileName Method, or can i somehow still use this method...

## Java - Getting file name without extension from a folder

java,filenames
I'm using this code to get the absolute path of files inside a folder public void addFiles(String fileFolder){ ArrayList<String> files = new ArrayList<String>(); fileOp.getFiles(fileFolder, files); } But I want to get only the file name of the files (without extension). How can I do this?...

## Calling a variable in Matlab without using the full name? [closed]

matlab,variables,filenames
I am creating a script to be universal in opening pre-made Data files that hold the same basic information, but the original files are not consistent in how they are named. An example, the same variable has 3 different variants in the different files: Data01.SubData Data01.SubData_01 Data01.SubData01 Is there a...

## How to get filename and location of file that starts a visual basic application?

vb.net,filenames,parent
Am on Windows 8 I have a visual basic 2010 express application that plays mp3 files. It has a button which opens an openfiledialog box to select the mp3 you want to play. However I have also set my vb app to be the default opener of mp3 files. When...

## Python 3 not aware of Windows filename encodings?

windows,python-3.x,encoding,path,filenames
The following code works well in Win7 until it crashes in the last print(f). It does it when it finds some "exotic" characters in the filenames, as the french "oe" as in œuvre and the C in Karel Čapek. The program crashes with an Encoding error, saying the character x...

## Exception handling, only accept specific file inputs

python,input,types,exception-handling,filenames
This is a bit above my pay grade, so I thought I would ask on here. My simple Python code prompts the user to enter the name of a file. However, it must be a specific type of file, or else I would like to throw an error. In this...

## Giving a string variable as a filename in matlab

string,matlab,filenames
I am using the below mentioned code to get the file names of images according to their id's from images_1 text file as strings and use them to read the images from their directory image_count=1; for image_count=1:6 file=fopen('D:\Academics\New folder\CUB_200_2011\images_1.txt','r'); C = textscan(file, '%s'); original_image=imread('D:\Academics\New folder\CUB_200_2011\images\%s','C{1}{2*(image_count)}'); imshow(original_image) end I am able...

php,filenames,sftp,phpseclib
I am trying to download a file from a SFTP server. I have managed to connect to it and download the files. The problem is that the file in the server will be updated daily and part of the filename is the exact time when it is generated which is...

## Cross check files in two folders

vbscript,match,filenames
I have two folders: Master folder & New folder. Files in two folders share the same file name. I need to cross check the files between these two folders. If Master folder does not have the file, I import it from New folder. If Master folder does have the file,...

## Getting NoneType Error When Using Regex to Change Filenames in Python

python,regex,filenames
I'm trying to use change a bunch of filenames using regex groups but can't seem to get it to work (despite writing what regexr.com tells me should be a valid regex statement). The 93,000 files I currently have all look something like this: Mr. McCONNELL.2012-07-31.2014sep19_at_182325.txt Mrs. HAGAN.2012-12-06.2014sep19_at_182321.txt Ms. MURRAY.2012-06-18.2014sep19_at_182246.txt The...

## regex for preg_replace: seperate path and filename

php,regex,preg-replace,filenames,filepath
In PHP I try to achieve to change a string: <img class="alignnone size-medium wp-image-18" src="http://localhost/wp-content/uploads/2015/02/300x149-jquerymobile.jpg" alt="jquerymobile" width="300" height="149"> to this: <img class="alignnone size-medium wp-image-18" src="" data-path="http://localhost/wp-content/uploads/2015/02/" data-img="300x149-jquerymobile.jpg" alt="jquerymobile" width="300" height="149"> I want wanna use preg_replace('/src="(what-is-a-path-regex)(.*)"/', 'src="" data-path="$1" data-img="$2"',...

## Python: how to obtain only first filename in the directory

python,path,filenames
I have path for the various directories. Now I want to look into header info of first file in each directory. Eg: path = "Users/SDB/case_23/scan_1" Now in sub directory scan_1 I want to check some header information. For this purpose how can I get complete path and name of first...

## VBA Excel: Make header depend on filename

I've created a Macro that takes care of a document's lay-out, print properties, etc. Now I'd like to add a way to make the header depend on the filename. If there is a W to be found in the filename, the header should read "Weekly report", in any other case...

## Change the file name Alfresco

I need to change the name of the file attached to the workflow and move to another location during the execution. The file name is generated based on the information entered in the form of process (Registration Number field and Sender). How can this be implemented? Thanks! For example: BX-2/Nick_Berry.xls...

## Beginner Python: save output file as argv input filename

python,filenames,argv
I want to save my generated plot with the same name as the input file. The input is through the command line, so I'm not really sure how to do it. #!/usr/bin/python import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt from numpy import arange,array,ones#,random,linalg from pylab import plot,show from scipy import...

## Why the names of some css, js files have random numbers in them?

html,web,filenames
Some websites seem to have file names such as 'assets/app-02b4523sev8fsd56e.js'. I have noticed that these numbers do not change though, so I thought it has something to do with security but I am not sure. Is there any reason behind this?

## Remove leading and tailing whitespaces from filename

linux,bash,shell,unix,filenames
I need a little help with a bash command in Ubuntu 14.04. I have a folder with many subfolders and some of the folder- and filenames have leading or tailing whitespaces. I like to rename these folders and files, but with the same filename, just without the whitespace an the...

## Saving multiple files with same name

c#,wpf,unique,filenames
I'm working on a C# WPF application that does some data processing and outputs files in .csv format. What I am trying to achieve is that every time my program runs, it produces a test.csv output file, however when I run again with new data.. the new resultant file overwrites...

## How do I get the name of Postscript file object?

filenames,postscript
Using Postscript, I want to retrieve the name of the file being executed. I know that I can get the file object using 'currentfile', but how do I get its name? I want to include the name in the document. Thanks....

## How to set the filename encoding globally for a python interpreter?

python,encoding,utf-8,filenames
In a project, we need to open many files all over the place in the source code. We know that all filenames on disk are encoded in utf-8 and all filenames are proceed as Unicode internally. Is there a way to set the filename encoding globally for the running interpreter,...

## Simple ZSH function and files with spaces in their name

whitespace,filenames,zsh,expansion
I have put the following function into my ~/.zshrc file: function note() { vim $HOME/Dropbox/$1.md } When I call it with note "20150209-132501-Recx-new note today.md" for example it creates a new file but with the file name "20150209-132501-Recx-new". I realise this is a simple question but how do I get...

## Batch-Script: Replace every “@” in file name with “_” in network drive including subfolders

batch-file,replace,folder,filenames
My Problem is this: I want to replace every Special character such as "@" in file names. Example: old file: [email protected] new file: test_home.txt This should be done in a special chosen Folder including subfolders. The user should easily Change the Location (Folder). Thx guys Alright Well, I will give...

## VBA – print file name in each row until the file closes

excel,vba,excel-vba,filenames
I have a working macro that loops through folder to open files and get important info from the columns of names "HOLDER" and "CUTTING TOOL" and printing all the info to one excel document, masterfile. It currently looks like picture 1. I would like it to print the file name...

## How to get file name of directory and written in button or label?

vb.net,directory,filenames
How can I find the file name of a directory? I would like to customize a label or button. Example: LigaBBVA.jpg then on the button or the label, LigaBBVA will also written without the extension....

## Using basename to name output file in java

java,find,xslt-1.0,filenames,zsh
I have a recursive structure of directories containing some foo files that I want to convert to bar files using a XSLT 1.0 stylesheet. I have: dir |-- subdir | |-- file1.foo | |-- file2.foo | |-- file3.foo And I want to obtain: dir |-- subdir | |-- file1.foo |...

## Powershell file and directory names as strings, sans decorations

string,powershell,filenames
Frequently I want to do something like: $foo=ls foo.txt|select FullName$bar=\$foo.split("\\"); # or replace or some such But if I now look at the strings in bar they look like this: @{FullName=C:\path\to\foo.txt} Since I know how long the decorations are I can manually get the substring. But that seems hacky...