Get work time of execution in BATCH
If you wish to see a time taked by some app execution, use next: @echo off setlocal set hours_before=%time:~0,2% set minutes_before=%time:~3,2% set seconds_before=%time:~6,2% REM Payload here: timeout...
View ArticleClear folder (subfolders and files) in BATCH
To delete all files and subfolders in given directory, you can use next snippet: @echo off setlocal enableextensions enabledelayedexpansion set pathDirToClear=C:\Tmp for /d %%A in (%pathDirToClear%)...
View ArticleWordPress upload add another file extensions
Just add the following code to you functions.php in theme: add_filter('upload_mimes', 'custom_upload_mimes'); function custom_upload_mimes ( $existing_mimes=array() ) { // add $existing_mimes['xpi'] =...
View ArticleControl Version System file structure proposals
Currently, i want to say a few words about CVS file structure. If you have a number of projects, probably deal with the problem of right files organization. In this case i mean projects are coupled...
View ArticleSet file and folder permissions in Linux
Convenient way to apply permissions in Linux is to save alias in .bashrc file: Set all permissions for FTP: alias setftpperm="chown -R _pure-ftpd:_pure-ftpd /usr/serv/ftp/anonymous && \ chmod...
View ArticleUsing SETLOCAL and ERRORLEVEL together in Batch
Interesting thing about using SETLOCAL and ERRORLEVEL together. Consider two files: first.bat @echo off echo %ERRORLEVEL% in first bat before setlocal setlocal echo Some actions with error finished...
View ArticleUnlock file in Windows with ProcessExplorer
It is often occurs locked files. How to unlock file from granted process? Very simple! Just use ProcessExplorer from Windows Sysinternals. Download here ProcessExplorer To perform unlocking, click...
View ArticleStream file download in a JSF managed bean
To output contents directly to browser in JSF 2.x use next method: public static void downloadFile(String fileName, String content, String contentType) throws IOException { FacesContext fc =...
View ArticleDelete files and folders with long names in Windows
Using command line you can delete files and folders with long names: rmdir /S /Q <FOLDER_NAME_TO_DELETE>
View ArticleRead and write files with stream in C#
Very basic example how to read and write files. The util class is as following: using System.IO; using System.Text; namespace Project.Dao { public class FileSystemUtils { public static string...
View Article