note
	description: "[
		File utilities, for retrieving files and folders and formatting paths.
	]"
	legal: "See notice at end of class."
	status: "See notice at end of class."
	date: "$Date: 2020-04-04 18:39:52 +0000 (Sat, 04 Apr 2020) $"
	revision: "$Revision: 104028 $"

expanded class interface
	FILE_UTILITIES

create 
	default_create

feature -- Query

	frozen compact_path (a_path: READABLE_STRING_32): detachable STRING_32
			-- Compacts a file path, removing . and ..
			--
			-- a_path: A path to compact.
			-- Result: The compacted path or Void if the path could not be compacted.
		require
			a_path_attached: a_path /= Void
			not_a_path_is_empty: not a_path.is_empty

	ends_with (a_folder: PATH; a_end_with: READABLE_STRING_GENERAL; a_levels: INTEGER_32): ARRAYED_LIST [PATH]
			-- Scans a folder for matching files.
			--
			-- a_folder: Folder location to scan.
			-- a_levels: Number of levels to recursively scan. 0 to scan the specified folder only, -1 to scan all folders.
			-- a_end_with: A string results end with, ignoring cases.
		require
			a_folder_exists: directory_path_exists (a_folder)
			a_levels_is_valid: a_levels >= -1
	
feature -- File name operations

	make_directory_name_in (name: READABLE_STRING_GENERAL; location: READABLE_STRING_GENERAL): READABLE_STRING_GENERAL
			-- A directory name for directory name in directory location.

	make_file_name_in (name: READABLE_STRING_GENERAL; location: READABLE_STRING_GENERAL): READABLE_STRING_GENERAL
			-- A file name for file name in directory location.
	
feature -- Directory operations

	directory_path_exists (p: PATH): BOOLEAN
			-- Does directory of path p exist?

	directory_exists (n: READABLE_STRING_GENERAL): BOOLEAN
			-- Does directory of name n exist?

	file_names (n: READABLE_STRING_32): detachable ARRAYED_LIST [STRING_32]
			-- List of file names in directory with name n.
			-- Or void if directory is not readable (does not exist, cannot be accessed, etc.).

	directory_names (n: READABLE_STRING_32): detachable ARRAYED_LIST [STRING_32]
			-- List of directory names (excluding current and parent directory) in directory with name n.
			-- Or void if directory is not readable (does not exist, cannot be accessed, etc.).

	create_directory_path (a_path: PATH)
			-- Creates a directory and any parent directories if they do not exist.
			--
			-- a_path: The path to create.
		require
			a_path_attached: a_path /= Void
			not_a_path_is_empty: not a_path.is_empty
		ensure
				class

	create_directory (a_path: READABLE_STRING_GENERAL)
			-- Creates a directory and any parent directories if they do not exist.
			--
			-- a_path: The directory to create.
		require
			a_path_attached: a_path /= Void
			not_a_path_is_empty: not a_path.is_empty
		ensure
				class
	
feature -- File operations

	copy_file (old_name, new_name: READABLE_STRING_GENERAL)
			-- Copy file named old_name to new_name.

	copy_file_path (old_path, new_path: PATH)
			-- Copy file named old_path to new_path.

	rename_file (old_name, new_name: READABLE_STRING_GENERAL)
			-- Rename file named old_name to new_name.

	rename_file_path (old_path, new_path: PATH)
			-- Rename file named old_path to new_path.

	file_exists (n: READABLE_STRING_GENERAL): BOOLEAN
			-- Does file of name n exist?

	file_path_exists (p: PATH): BOOLEAN
			-- Does file of path p exist?
	
note
	copyright: "Copyright (c) 1984-2020, Eiffel Software and others"
	license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
	licensing_options: "http://www.eiffel.com/licensing"
	copying: "[
		This file is part of Eiffel Software's Eiffel Development Environment.
		
		Eiffel Software's Eiffel Development Environment is free
		software; you can redistribute it and/or modify it under
		the terms of the GNU General Public License as published
		by the Free Software Foundation, version 2 of the License
		(available at the URL listed under "license" above).
		
		Eiffel Software's Eiffel Development Environment is
		distributed in the hope that it will be useful, but
		WITHOUT ANY WARRANTY; without even the implied warranty
		of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
		See the GNU General Public License for more details.
		
		You should have received a copy of the GNU General Public
		License along with Eiffel Software's Eiffel Development
		Environment; if not, write to the Free Software Foundation,
		Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
	]"
	source: "[
		Eiffel Software
		5949 Hollister Ave., Goleta, CA 93117 USA
		Telephone 805-685-1006, Fax 805-685-6869
		Website http://www.eiffel.com
		Customer support http://support.eiffel.com
	]"

end -- class FILE_UTILITIES

Generated by ISE EiffelStudio