file-extension

recursively add file extension to all files

老子叫甜甜 提交于 2019-11-27 04:56:59
问题 I have a few directories and sub-directories containing files with no file extension. I want to add .jpg to all the files contained within these directories. I've seen bash scripts for changing the file extension but not for just adding one. It also needs to be recursive, can someone help please? 回答1: Alternative command without an explicit loop (man find): find . -type f -exec mv '{}' '{}'.jpg \; Explanation: this recursively finds all files ( -type f ) starting from the current directory (

Command Prompt: Execute Commands from Any Text File (Not Having “.bat” or “.cmd” Extensions)

走远了吗. 提交于 2019-11-27 04:52:08
问题 I can't find any way to do, for example, the following: cmd.exe /C "script.txt" In other words, I need Command Prompt to (try) to execute file with any extension (not necessarily .bat or .cmd ) if it contains valid batch script code. I'm looking for behavior similar to Unix shells: ./script.txt While on Unix the shebang ( #!/bin/sh ) is responsible for understanding that the file is actually a script, it seems like on Windows .bat or .cmd extensions play the same role, indicating a batch

Is an Application Associated With a Given Extension?

故事扮演 提交于 2019-11-27 04:31:18
问题 It is sometimes desirable to have your application open the default application for a file. For example, to open a PDF file you might use: System.Diagnostics.Process.Start("Filename.pdf"); To open an image, you'd just use the same code with a different filename: System.Diagnostics.Process.Start("Filename.gif"); Some extensions (.gif for example) just about always have a default handler, even in a base Windows installation. However, some extensions (.pdf for example) often don't have an

How to get list of all files with ESY extension in a directory?

扶醉桌前 提交于 2019-11-27 03:55:01
问题 In VBA, how do I get a list of all the files with a specific extension in a specific directory? i am unable to do Application.FileSearch , because i am using excel 2007 回答1: In response to your comment "so how many times do i know to run it?" , this example runs until it lists all the files whose names match strPattern . Change the strFolder constant. Public Sub ListESY() Const strFolder As String = "C:\SomeFolder\" Const strPattern As String = "*.ESY" Dim strFile As String strFile = Dir

Codeigniter multiple file upload messes file extension

痴心易碎 提交于 2019-11-27 03:12:31
I am trying to get a multiple upload library working for my Codeigniter based website. I have it working almost but I have a slight problem if I upload more than one image, the file extentions get screwed up; for example, if I upload three JPEGS, I get this in my uploads folder, image1.jpg image2.jpg.jpg image3.jpg.jpg.jpg I cannot see what is causing it, this is the library in question and I am pretty sure that it is in there that the problem is, <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /** * This library assumes that you have already loaded the default CI

Remove filename extension in Java

♀尐吖头ヾ 提交于 2019-11-27 02:07:55
问题 (Without including any external libraries.) What's the most efficient way to remove the extension of a filename in Java, without assuming anything of the filename? Some examples and expected results: folder > folder hello.txt > hello read.me > read hello.bkp.txt > hello.bkp weird..name > weird. .hidden > .hidden (or should the last one be just hidden ?) Edit : The original question assumed that the input is a filename (not a file path). Since some answers are talking about file paths, such

PHP check file exists without knowing the extension

坚强是说给别人听的谎言 提交于 2019-11-27 00:28:09
问题 I need to check if a file exists but I don't know the extension. IE I would like to do: if(file_exists('./uploads/filename')): // do something endif; Of course that wont work as it has no extension. the extension will be either jpg, jpeg, png, gif Any ideas of a way of doing this without doing a loop ? 回答1: You would have to do a glob(): $result = glob ("./uploads/filename.*"); and see whether $result contains anything. 回答2: I've got the same need, and tried to use glob but this function

Why do Objective-C files use the .m extension?

我的未来我决定 提交于 2019-11-26 22:29:59
问题 Since I started learning Objective-C and Cocoa, I've been wondering why they have chosen the extension .m for the implementation files - was it supposed to mean something, or was it just a random letter? 回答1: Today most people would refer to them as "method files", but "The .m extension originally stood for " m essages" when Objective-C was first introduced, referring to a central feature of Objective-C [...]" (from the book "Learn Objective-C on the Mac" by Mark Dalrymple and Scott Knaster,

Integrating into Windows Explorer context menu

那年仲夏 提交于 2019-11-26 22:19:17
I want to write a small tool, that does the following: When you right click on a file with a certain file-extension the Windows Explorer context menu shows an additional entry. When you click this entry a certain EXE is launched with this file as one of its parameters. I would like to use C#/.NET 2.0 for this. If it's not possible I could also do it with C++/Win32. My questions are: Is it possible with C# .NET 2.0? What are the necessary functions for integrating into the Windows Explorer context menu? How can I make this permanent? (I don't want to relaunch this tool after every boot) What do

Hide Page Extensions (Like StackOverflow)

落花浮王杯 提交于 2019-11-26 22:10:41
问题 I want to hide page extensions like stackoverflow does. How does the following work? http://stackoverflow.com/tags/foo http://stackoverflow.com/tags/bar I've seen a lot of sites that do this, but I still don't know how this is accomplished (I have a LAMP stack). 回答1: When a web server gets a request for a URL, it has to decide how to handle it. The classic method was to map the head of the URL to a directory in the file system, then let the rest of the URL navigate to a file in the filesystem