filenames

Can't copy/move files with space at end of file name

老子叫甜甜 提交于 2019-12-12 10:35:04
问题 It's really crazy! I have created a file using Far 2.0 (http://www.farmanager.com/, maybe you can use some other file manager); its filename is 'C:\123.txt ' (yes, with space at the end of filepath) . And I'm trying to copy or move this file using a C# program: File.Copy("C:\\123.txt ", "C:\\456.txt", true); But it fails with the "Could not find file 'C:\123.txt '." exception. But the file exists! I'm trying the Windows API: [DllImport("kernel32.dll")] public static extern int MoveFile(string

Firefox has problems when downloading with a space in filename

我的未来我决定 提交于 2019-12-12 10:29:50
问题 It seems that firefox has a problem with spaces within the filename for downloading... header( 'Content-Type: text/csv' ); header( 'Content-Disposition: attachment;filename='.$filename); $fp = fopen('php://output', 'w'); fputs($fp, $csvdata); fclose($fp); Here is an example of a file named: Test_ Grad Fair 2_20140129_1312_607.csv When I attempt to download the file using the code above with FireFox the following occurs. (the main problem is it removes the file extension!) And when I try

Force Save as XLSM While Maintaining File Structure

时光毁灭记忆、已成空白 提交于 2019-12-12 09:45:57
问题 So I am working with a XLTM file, and I want the user to make sure they save as XLSM. When they click "Save," this works fine, but I find when they click "Save As," the file is saved as "*.xlsm.xlsm". I am a little lost with how to make sure that the user saves as XLSM, while keeping the file name as "filename.xlsm" and not "filename.xlsm.xlsm". 'Action makes sure the user saves as XLSM file type. Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Dim FileNameVal As

Filtering filechooser via filename

夙愿已清 提交于 2019-12-12 09:45:50
问题 I learned how to use filter using filefilter. FileFilter filter = new FileNameExtensionFilter("JPEG file", "jpg", "jpeg"); But I want to filter my filechooser with files containing certain strings in them like having "sample" in their filenames. Only files that does have these strings can be chosen and this filter must not be editable. How can I do it? 回答1: public class ImageFilter extends FileFilter { //Accept all directories and all jpeg, jpg files with lossy in its filename. public boolean

log4net: How to set logger file name dynamically?

我怕爱的太早我们不能终老 提交于 2019-12-12 08:21:34
问题 This is a really common question, but I have not been able to get an answer to work. Here is my configuration file: <?xml version="1.0" encoding="utf-8"?> <log4net> <appender name="RollingFile" type="log4net.Appender.RollingFileAppender"> <file value="CraneUserInterface.log" /> <appendToFile value="true" /> <maxSizeRollBackups value="90" /> <rollingStyle value="Size" /> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%date - %message%newline" /> </layout> </appender>

Symfony custom filename for uploaded image files

邮差的信 提交于 2019-12-12 06:46:40
问题 I'm aware of VichUpload and namers, but I have to face two different file uploads, and I need special naming conventions that I'm unable to get with the current VichUpload documentation. First file upload is for an entity called "School", which manages every single school, and its logo. So, taking as web root '../web/files/schools/', then I'd take the school_id and then the 'logo' folder with the uploaded file name, so it could be '../web/files/schools/000001/logo.png'. Then, the second

how to batch move files date filename folder?

随声附和 提交于 2019-12-12 06:12:52
问题 I have lots of image files named as YYYYMMDD_HHmm.jpg How can I move these files to: target_directory\YYYY\MM\YYYYMMDD_HHmm.jpg ? Thank you 回答1: You can use a for loop, substrings, and mkdir : @echo off setlocal enabledelayedexpansion for /f %%a in ('dir /b /a-d') do ( set filename=%%a ::exclude this file if not "!filename!" == "%~nx0" ( ::substr to grab characters 0-4 and 4-6 as year and month set year=!filename:~0,4! set month=!filename:~4,2! ::make dirs for the files if they don't already

How to assign a value to a variable from a text file? [closed]

泄露秘密 提交于 2019-12-12 04:38:31
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 5 years ago . I am using a script to back up files from ftp. code is below. include "recurseZip.php"; //Source file or directory to be compressed. $src='source/images/black.png'; //Destination folder where we create Zip file. $dst='backup'; $z=new recurseZip(); echo $z->compress($src,$dst); Now I want to get

SilverStripe 3.1+ change FileNameFilter default replacements

老子叫甜甜 提交于 2019-12-12 04:26:19
问题 Currently uploading a file with an '_' (underscore) in it is automatically replace with '-' (hyphen). I need them to stay as _ . The same as this issue: https://github.com/silverstripe/silverstripe-cms/issues/719 I've discovered this happens via FileNameFilter http://api.silverstripe.org/master/class-FileNameFilter.html#_setReplacements I've tried to follow the instructions to stop this by adding this to the YAML config: FileNameFilter: default_use_transliterator: false default_replacements:

Parse jar filenames

半城伤御伤魂 提交于 2019-12-12 03:06:33
问题 Let's say you want the best pattern to extract both name and version from a jar filename. I got something not so bad which works on regexr but not with bash. This is because bash does not support non-greedy regex. So how should one handle this? #!/bin/bash filename="./log4j-enhanced-3.5.100-v20130422-1538.jar" if [[ "$filename" =~ \.\/(.*?)-([0-9].*)\.jar ]]; then echo "name = ${BASH_REMATCH[1]}" echo "version = ${BASH_REMATCH[2]}" fi # expected : # name = log4j-enhanced # version = 3.5.100